Class: TBMX::SingleCharacterToken

Inherits:
Token show all
Defined in:
lib/tbmx.rb

Direct Known Subclasses

BackslashToken, LeftBraceToken, RightBraceToken

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.character_matchedObject



71
72
73
# File 'lib/tbmx.rb', line 71

def character_matched
  self::CHARACTER_MATCHED
end

.matches?(text) ⇒ Boolean

Returns:

  • (Boolean)


75
76
77
78
79
80
81
# File 'lib/tbmx.rb', line 75

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

Instance Method Details

#textObject



66
67
68
# File 'lib/tbmx.rb', line 66

def text
  self.class.character_matched
end