lib/aws/cfn/compiler/mixins/parse.rb in aws-cfn-compiler-0.8.5 vs lib/aws/cfn/compiler/mixins/parse.rb in aws-cfn-compiler-0.8.6

- old
+ new

@@ -83,12 +83,13 @@ def parse_rb_file(base, section, filename) Aws::Cfn::Compiler.binding ||= {} Aws::Cfn::Compiler.binding[section] ||= {} Aws::Cfn::Compiler.binding[section][base] ||= { brick_path: @config[:directory], - template: @dsl, - logger: @logger + template: @dsl, + logger: @logger, + compiler: self } source_file = File.expand_path(filename) # source = IO.read(source_file) eval "require source_file", binding unless @dsl.dict[section.to_sym] @@ -97,21 +98,23 @@ sym_to_s(@dsl.dict[section.to_sym]) end def sym_to_s(hash) case hash.class.name - when /Hash/ - item = {} - hash.each { |k,v| - item[k.to_s] = sym_to_s(v) - } - item - when /Array/ - hash.map{|e| sym_to_s(e) } - when /Fixnum|String|TrueClass|FalseClass/ - hash - else - abort! "Internal error: #{hash} is a #{hash.class.name} which our Ruby parsing is not prepared for. Fix #{__FILE__}::sym_to_s" + when /Hash/ + item = {} + hash.each { |k,v| + item[k.to_s] = sym_to_s(v) + } + item + when /Array/ + hash.map{|e| sym_to_s(e) } + when /Fixnum|String|TrueClass|FalseClass/ + hash + when /Symbol/ + hash.to_s + else + abort! "Internal error: #{hash} is a #{hash.class.name} which our Ruby parsing is not prepared for. Fix #{__FILE__}::sym_to_s" end end end end