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 10 def call(exp) compile(exp) end
on_code(exp)
click to toggle source
# File lib/haml/generator.rb, line 26 def on_code(exp) exp end
on_dynamic(code)
click to toggle source
# File lib/haml/generator.rb, line 22 def on_dynamic(code) concat(code) end
on_multi(*exp)
click to toggle source
# File lib/haml/generator.rb, line 14 def on_multi(*exp) exp.map { |e| compile(e) }.join('; ') end
on_newline()
click to toggle source
# File lib/haml/generator.rb, line 30 def on_newline "\n" end
on_static(text)
click to toggle source
# File lib/haml/generator.rb, line 18 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 36 def concat(str) "_hamlout.buffer << (#{str});" end