Class: Ruby2JS::Token

Inherits:
String
  • Object
show all
Defined in:
lib/ruby2js/serializer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string, ast) ⇒ Token

Returns a new instance of Token.



6
7
8
9
10
# File 'lib/ruby2js/serializer.rb', line 6

def initialize(string, ast)
  super(string.to_s)
  @ast = ast
  @loc = ast.location if ast
end

Instance Attribute Details

#astObject

Returns the value of attribute ast.



4
5
6
# File 'lib/ruby2js/serializer.rb', line 4

def ast
  @ast
end

#locObject

Returns the value of attribute loc.



3
4
5
# File 'lib/ruby2js/serializer.rb', line 3

def loc
  @loc
end