lib/jcompiler/provider.rb in jcompiler-0.1.112 vs lib/jcompiler/provider.rb in jcompiler-0.1.113
- old
+ new
@@ -1,19 +1,21 @@
class Jcompiler::Provider
+ attr_accessor :context
+
def initialize
@context = nil
end
def object!(arg_name = nil, &block)
pre_context = @context
- @context = []
+ context = []
srcs, subst_src = if arg_name
[block.call(nil), "#{block.parameters[0][1]}=#{arg_name};"]
else
[block.call, '']
end
- @context = pre_context
+ context = pre_context
%{"{\#{#{subst_src}[#{srcs.join(',')}].join(',')}}"}
end
def array!(arg_name, &block)
item_name = block.parameters[0][1].to_s
@@ -24,12 +26,8 @@
def integer!(i)
%{"#{i}"}
end
def method_missing(name, *args, &block)
- @context << %{"\\"#{name}\\":3"}
+ context << %{"\\"#{name}\\":3"}
end
-
- private
-
- attr_accessor :context
end