lib/jcompiler.rb in jcompiler-0.1.39 vs lib/jcompiler.rb in jcompiler-0.1.40
- old
+ new
@@ -1,6 +1,14 @@
class Jcompiler
+ def initialize
+ @ids = {}
+ end
+
+ private
+
+ attr_accessor :ids
+
def b(brand, bind)
bind.local_variable_set(:brand, brand)
{
id: 'brand.id',
name: 'brand.name',
@@ -22,23 +30,22 @@
brands.map do |brand|
"{#{b(brand, bind).join(',')}}"
end
end
- def code(brands, bind)
- bind.local_variable_set(:brands, brands)
- "[#{a(brands, bind).join(',')}]"
+ def code(bind)
+ debugger
end
end
class JcompilerHandler
cattr_accessor :default_format
self.default_format = Mime::JSON
@@jcompiler = Jcompiler.new
def self.call(template)
- "@@jcompiler.code(@brands, binding)"
+ "@@jcompiler.code(template.identifier, template.source, binding)"
end
end
ActionView::Template.register_template_handler :jcompiler, JcompilerHandler