Class: Perforce2Svn::Mapping::Token

Inherits:
Object
  • Object
show all
Defined in:
lib/perforce2svn/mapping/lexer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#argsObject (readonly)

Returns the value of attribute args.



5
6
7
# File 'lib/perforce2svn/mapping/lexer.rb', line 5

def args
  @args
end

#line_numberObject (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

#nameObject (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_sObject



17
18
19
# File 'lib/perforce2svn/mapping/lexer.rb', line 17

def to_s
  "{@(#{line_number}) name: #{name}; args: #{args.join(' ')} }"
end