Class: FAM::Syntax::TokenObject
Instance Attribute Summary collapse
-
#col ⇒ Object
readonly
Returns the value of attribute col.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type, name, location) ⇒ TokenObject
constructor
A new instance of TokenObject.
- #to_s ⇒ Object (also: #pretty_inspect)
Constructor Details
#initialize(type, name, location) ⇒ TokenObject
Returns a new instance of TokenObject.
51 52 53 54 55 56 |
# File 'lib/fam/syntax/tokens.rb', line 51 def initialize type, name, location @type = type @name = name @line = location[:line] @col = location[:col] end |
Instance Attribute Details
#col ⇒ Object (readonly)
Returns the value of attribute col.
49 50 51 |
# File 'lib/fam/syntax/tokens.rb', line 49 def col @col end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
49 50 51 |
# File 'lib/fam/syntax/tokens.rb', line 49 def line @line end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
49 50 51 |
# File 'lib/fam/syntax/tokens.rb', line 49 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
49 50 51 |
# File 'lib/fam/syntax/tokens.rb', line 49 def type @type end |
Instance Method Details
#to_s ⇒ Object Also known as: pretty_inspect
58 59 60 61 |
# File 'lib/fam/syntax/tokens.rb', line 58 def to_s value = @name == "\n" ? '\n' : @name "TOKEN<:#{@type}>(`#{value}`)" end |