Class: Haml::AttributeCompiler::AttributeValue

Inherits:
Struct
  • Object
show all
Defined in:
lib/haml/attribute_compiler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#keyObject

Returns the value of attribute key



9
10
11
# File 'lib/haml/attribute_compiler.rb', line 9

def key
  @key
end

#typeObject

Returns the value of attribute type



9
10
11
# File 'lib/haml/attribute_compiler.rb', line 9

def type
  @type
end

#valueObject

Returns the value of attribute value



9
10
11
# File 'lib/haml/attribute_compiler.rb', line 9

def value
  @value
end

Instance Method Details

#base_key

Key's substring before a hyphen. This is necessary because values with the same base_key can conflict by Haml::AttributeBuidler#build_data_keys.



22
23
24
# File 'lib/haml/attribute_compiler.rb', line 22

def base_key
  key.split('-', 2).first
end

#to_literalString



11
12
13
14
15
16
17
18
# File 'lib/haml/attribute_compiler.rb', line 11

def to_literal
  case type
  when :static
    Haml::Util.inspect_obj(value)
  when :dynamic
    value
  end
end