Class: Haml::Parser::DynamicAttributes

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

Overview

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#old=(value) ⇒ String

Sets the attribute old

Parameters:

  • value (String)

    the value to set the attribute old to.

Returns:

  • (String)

    the newly set value



236
237
238
# File 'lib/haml/parser.rb', line 236

def old=(value)
  @old = value
end

Instance Method Details

#newline_count

The lines a tag spans beyond its first because of these attributes, which is what the compiled tag has to span too for the line numbers after it to hold.



252
253
254
# File 'lib/haml/parser.rb', line 252

def newline_count
  (new ? new.count("\n") : 0) + (old ? old.count("\n") : 0)
end

#to_literal

This will be a literal for Haml::HamlBuffer#attributes’s last argument, attributes_hashes.



246
247
248
# File 'lib/haml/parser.rb', line 246

def to_literal
  [new, stripped_old].compact.join(', ')
end