class Haml::AttributeCompiler::AttributeValue

@param type [Symbol] :static or :dynamic @param key [String] @param value [String] Actual string value for :static type, value's Ruby literal for :dynamic type.

Public Instance Methods

base_key() click to toggle source

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

# File lib/haml/attribute_compiler.rb, line 21
def base_key
  key.split('-', 2).first
end
to_literal() click to toggle source
# File lib/haml/attribute_compiler.rb, line 10
def to_literal
  case type
  when :static
    Haml::Util.inspect_obj(value)
  when :dynamic
    value
  end
end