Module: Hamlit::Compilers::RuntimeAttribute
- Includes:
- Hamlit::Concerns::StringInterpolation
- Included in:
- Attributes
- Defined in:
- lib/hamlit/compilers/runtime_attribute.rb
Instance Method Summary collapse
-
#merge_runtime_attributes(attrs) ⇒ Object
Given html attrs, merge classes and ids to :dynamic_attribute.
-
#on_runtime(str) ⇒ Object
This is used for compiling only runtime attribute in Compilers::Attribute.
Methods included from Hamlit::Concerns::StringInterpolation
#contains_interpolation?, #string_literal
Instance Method Details
#merge_runtime_attributes(attrs) ⇒ Object
Given html attrs, merge classes and ids to :dynamic_attribute.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/hamlit/compilers/runtime_attribute.rb', line 17 def merge_runtime_attributes(attrs) merge_targets = filter_attrs(attrs, 'id', 'class') dynamic_attr = attrs.find { |exp, *args| exp == :runtime } attrs -= merge_targets attrs.delete(dynamic_attr) base = decompile_temple_attrs(merge_targets) [compile_runtime_attribute(dynamic_attr.last, base), *attrs] end |
#on_runtime(str) ⇒ Object
This is used for compiling only runtime attribute in Compilers::Attribute.
12 13 14 |
# File 'lib/hamlit/compilers/runtime_attribute.rb', line 12 def on_runtime(str) compile_runtime_attribute(str) end |