Class: Perforce2Svn::Mapping::Token
- Inherits:
-
Object
- Object
- Perforce2Svn::Mapping::Token
- Defined in:
- lib/perforce2svn/mapping/lexer.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#line_number ⇒ Object
readonly
Returns the value of attribute line_number.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #[](index) ⇒ Object
-
#initialize(name, args, line_number) ⇒ Token
constructor
A new instance of Token.
- #to_s ⇒ Object
Constructor Details
#initialize(name, args, line_number) ⇒ Token
Returns a new instance of Token.
7 8 9 10 11 |
# File 'lib/perforce2svn/mapping/lexer.rb', line 7 def initialize(name, args, line_number) @name = name.gsub(/-/, '_') @args = args @line_number = line_number end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
5 6 7 |
# File 'lib/perforce2svn/mapping/lexer.rb', line 5 def args @args end |
#line_number ⇒ Object (readonly)
Returns the value of attribute line_number.
5 6 7 |
# File 'lib/perforce2svn/mapping/lexer.rb', line 5 def line_number @line_number end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/perforce2svn/mapping/lexer.rb', line 5 def name @name end |
Instance Method Details
#[](index) ⇒ Object
13 14 15 |
# File 'lib/perforce2svn/mapping/lexer.rb', line 13 def [](index) @args[index] end |
#to_s ⇒ Object
17 18 19 |
# File 'lib/perforce2svn/mapping/lexer.rb', line 17 def to_s "{@(#{line_number}) name: #{name}; args: #{args.join(' ')} }" end |