Module: Hamlit::Compilers::NewAttribute

Includes:
Hamlit::Concerns::Lexable
Included in:
Attributes
Defined in:
lib/hamlit/compilers/new_attribute.rb

Constant Summary

Constants included from Hamlit::Concerns::Lexable

Hamlit::Concerns::Lexable::TYPE_POSITION

Instance Method Summary collapse

Methods included from Hamlit::Concerns::Lexable

#convert_position, #skip_tokens!, #type_of

Instance Method Details

#compile_new_attribute(str) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/hamlit/compilers/new_attribute.rb', line 10

def compile_new_attribute(str)
  str   = str.gsub(/\A\(|\)\Z/, '')
  attrs = parse_new_attributes(str)
  attrs.map do |key, value|
    next true_attribute(key) if value == 'true'
    [:html, :attr, key, [:dynamic, value]]
  end
end