Sha256: 38a2f3c35ab32542c27c07b2dc6a2fe7cf48908aaf949b359406abdb9ad22199
Contents?: true
Size: 810 Bytes
Versions: 4
Compression:
Stored size: 810 Bytes
Contents
require 'shikashi' module Confidante module Converters class EvaluatingConverter def initialize @sandbox = Shikashi::Sandbox.new @privileges = Shikashi::Privileges.new end def convert(thing) case thing when Hash convert_hash(thing) when Array convert_array(thing) else convert_item(thing) end end private def convert_hash(thing) {}.tap do |h| thing.each { |k, v| h[k.to_sym] = convert(v) } end end def convert_array(thing) thing.map { |v| convert(v) } end def convert_item(thing) begin @sandbox.run(@privileges, thing) rescue Exception thing end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems