Class: Lexeme::Token
- Inherits:
-
Object
- Object
- Lexeme::Token
- Defined in:
- lib/lexeme/token.rb
Instance Attribute Summary collapse
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(name, value, line) ⇒ Token
constructor
A new instance of Token.
- #to_a ⇒ Object
- #to_array ⇒ Object
- #to_ary ⇒ Object
- #to_hash ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(name, value, line) ⇒ Token
Returns a new instance of Token.
5 6 7 8 9 |
# File 'lib/lexeme/token.rb', line 5 def initialize(name, value, line) @name = name @value = value @line = line end |
Instance Attribute Details
#line ⇒ Object (readonly)
Returns the value of attribute line.
3 4 5 |
# File 'lib/lexeme/token.rb', line 3 def line @line end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/lexeme/token.rb', line 3 def name @name end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
3 4 5 |
# File 'lib/lexeme/token.rb', line 3 def value @value end |
Instance Method Details
#to_a ⇒ Object
27 28 29 |
# File 'lib/lexeme/token.rb', line 27 def to_a to_ary end |
#to_array ⇒ Object
23 24 25 |
# File 'lib/lexeme/token.rb', line 23 def to_array to_ary end |
#to_ary ⇒ Object
19 20 21 |
# File 'lib/lexeme/token.rb', line 19 def to_ary [name, value, line] end |
#to_hash ⇒ Object
15 16 17 |
# File 'lib/lexeme/token.rb', line 15 def to_hash {:line => line, :name => name, :value => value} end |
#to_s ⇒ Object
11 12 13 |
# File 'lib/lexeme/token.rb', line 11 def to_s "#{line} => #{name} : #{value}" end |