class Haml::Parser::DynamicAttributes

@param [String] old - Hash literal including dynamic values or Ruby literal of multiple Hashes which MUST be interpreted as method’s last arguments.
@param [String] new - Hash literal including dynamic values.

def old=(value)

def old=(value)
  unless value =~ /\A{.*}\z/m
    raise ArgumentError.new('Old attributes must start with "{" and end with "}"')
  end
  super
end

def stripped_old

For `%foo{ { foo: 1 }, bar: 2 }`, :old is "{ { foo: 1 }, bar: 2 }" and this method returns " { foo: 1 }, bar: 2 " for last argument.
def stripped_old
  return nil if old.nil?
  old.sub!(/\A{/, '').sub!(/}\z/m, '')
end

def to_literal

This will be a literal for Haml::Buffer#attributes's last argument, `attributes_hashes`.
def to_literal
  [new, stripped_old].compact.join(', ')
end