Class: Haml::AttributeCompiler
- Inherits:
-
Object
- Object
- Haml::AttributeCompiler
- Defined in:
- lib/haml/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.
8 9 10 11 12 13 |
# File 'lib/haml/attribute_compiler.rb', line 8 def initialize(identity, ) @identity = identity @quote = [:attr_quote] @format = [:format] @escape_attrs = [:escape_attrs] end |
Instance Method Details
#compile(node) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/haml/attribute_compiler.rb', line 15 def compile(node) hashes = [] if node.value[:object_ref] != :nil || !AttributeParser.available? return runtime_compile(node) end [node.value[:dynamic_attributes].new, node.value[:dynamic_attributes].old].compact.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 |