Class: Opulent::Tokens
- Inherits:
-
Object
- Object
- Opulent::Tokens
- Defined in:
- lib/opulent/tokens.rb
Class Method Summary collapse
-
.[](name) ⇒ Object
Return the requested token to the parser.
-
.[]=(name, token) ⇒ Object
Set a new token at runtime.
-
.bracket(bracket) ⇒ Object
Return the matching closing bracket.
Class Method Details
.[](name) ⇒ Object
Return the requested token to the parser
163 164 165 |
# File 'lib/opulent/tokens.rb', line 163 def self.[](name) @tokens[name] end |
.[]=(name, token) ⇒ Object
Set a new token at runtime
172 173 174 |
# File 'lib/opulent/tokens.rb', line 172 def self.[]=(name, token) @tokens[name] = token end |
.bracket(bracket) ⇒ Object
Return the matching closing bracket
150 151 152 153 154 155 156 157 |
# File 'lib/opulent/tokens.rb', line 150 def self.bracket(bracket) case bracket when '(' then return ')' when '[' then return ']' when '{' then return '}' when '<' then return '>' end end |