Class: Haml2Erb::Tokens::InnerAttributeQuoted

Inherits:
Token
  • Object
show all
Defined in:
lib/haml2erb/tokens.rb

Instance Attribute Summary

Attributes inherited from Token

#matched, #options

Class Method Summary collapse

Methods inherited from Token

#initialize

Constructor Details

This class inherits a constructor from Haml2Erb::Tokens::Token

Class Method Details

.match(text) ⇒ Object



83
84
85
86
87
88
89
90
91
# File 'lib/haml2erb/tokens.rb', line 83

def self.match(text)
  match_data = @regex.match(text)
  if(match_data) 
    value = match_data[4].gsub(/#\{([^\}]+?)\}/, '<%= \1 %>') # replace #{ value } with <%= value %>
    self.new(match_data.to_s, :element_attribute => { match_data[1] => value })
  else
    nil
  end
end