Class: Teepee::SingleCharacterToken

Inherits:
Token show all
Defined in:
lib/teepee/single-character-token.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ParserNode

#to_html, #use_scope

Class Method Details

.character_matchedObject



47
48
49
# File 'lib/teepee/single-character-token.rb', line 47

def character_matched
  self::CHARACTER_MATCHED
end

.matches?(text) ⇒ Boolean

Returns:

  • (Boolean)


51
52
53
54
55
56
57
# File 'lib/teepee/single-character-token.rb', line 51

def matches? text
  if text.first == character_matched
    return [self.new, text.rest]
  else
    return nil
  end
end

Instance Method Details

#textObject



42
43
44
# File 'lib/teepee/single-character-token.rb', line 42

def text
  self.class.character_matched
end