class Haml::Generator
Ruby code generator, which is a limited version of Temple::Generator. Limit methods since Haml
doesn’t need most of them.
Public Instance Methods
call(exp)
click to toggle source
# File lib/haml/generator.rb, line 12 def call(exp) compile(exp) end
on_code(exp)
click to toggle source
# File lib/haml/generator.rb, line 28 def on_code(exp) exp end
on_dynamic(code)
click to toggle source
# File lib/haml/generator.rb, line 24 def on_dynamic(code) concat(code) end
on_multi(*exp)
click to toggle source
# File lib/haml/generator.rb, line 16 def on_multi(*exp) exp.map { |e| compile(e) }.join('; ') end
on_newline()
click to toggle source
# File lib/haml/generator.rb, line 32 def on_newline "\n" end
on_static(text)
click to toggle source
# File lib/haml/generator.rb, line 20 def on_static(text) concat(options[:freeze_static] ? "#{Util.inspect_obj(text)}.freeze" : Util.inspect_obj(text)) end
Private Instance Methods
concat(str)
click to toggle source
# File lib/haml/generator.rb, line 38 def concat(str) "_hamlout.buffer << (#{str});" end