Class: Hamlit::AttributeCompiler
- Defined in:
- lib/hamlit/attribute_compiler.rb
Instance Method Summary collapse
- #compile(node) ⇒ Object
-
#initialize(identity, options) ⇒ AttributeCompiler
constructor
A new instance of AttributeCompiler.
Constructor Details
#initialize(identity, options) ⇒ AttributeCompiler
Returns a new instance of AttributeCompiler.
9 10 11 12 13 14 |
# File 'lib/hamlit/attribute_compiler.rb', line 9 def initialize(identity, ) @identity = identity @quote = [:attr_quote] @format = [:format] @escape_attrs = [:escape_attrs] end |
Instance Method Details
#compile(node) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/hamlit/attribute_compiler.rb', line 16 def compile(node) hashes = [] return runtime_compile(node) if node.value[:object_ref] != :nil node.value[:attributes_hashes].each do |attribute_str| hash = AttributeParser.parse(attribute_str) return runtime_compile(node) unless hash hashes << hash end static_compile(node.value[:attributes], hashes) end |