Class: Haml2Erb::Tokens::ContentsStart

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



38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/haml2erb/tokens.rb', line 38

def self.match(text)
  match_data = @regex.match(text)
  if match_data
    @return_token = case match_data[1][0,1]
    when ' ' then self.new(match_data.to_s, :content_type => :text)
    when '='
      match_data[1][1,1] == '=' ? self.new(match_data.to_s, :content_type => :mixed) : self.new(match_data.to_s, :content_type => :ruby)
    end
  else
    @return_token = nil
  end
  @return_token
end