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 11
def call(exp)
  compile(exp)
end
on_code(exp) click to toggle source
# File lib/haml/generator.rb, line 27
def on_code(exp)
  exp
end
on_dynamic(code) click to toggle source
# File lib/haml/generator.rb, line 23
def on_dynamic(code)
  concat(code)
end
on_multi(*exp) click to toggle source
# File lib/haml/generator.rb, line 15
def on_multi(*exp)
  exp.map { |e| compile(e) }.join('; ')
end
on_newline() click to toggle source
# File lib/haml/generator.rb, line 31
def on_newline
  "\n"
end
on_static(text) click to toggle source
# File lib/haml/generator.rb, line 19
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 37
def concat(str)
  "_hamlout.buffer << (#{str});"
end