Class: Haml2Erb::Tokens::Token

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(matched, options = {}) ⇒ Token

Returns a new instance of Token.



7
8
9
10
# File 'lib/haml2erb/tokens.rb', line 7

def initialize(matched, options = {})
  @matched = matched
  @options = options
end

Instance Attribute Details

#matchedObject (readonly)

Returns the value of attribute matched.



5
6
7
# File 'lib/haml2erb/tokens.rb', line 5

def matched
  @matched
end

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/haml2erb/tokens.rb', line 5

def options
  @options
end

Class Method Details

.match(text) ⇒ Object



12
13
14
15
# File 'lib/haml2erb/tokens.rb', line 12

def self.match(text)
  match_data = @regex.match(text)
  match_data ? self.new(match_data.to_s) : nil
end