Class: RDoc::RubyToken::TkVal

Inherits:
Token
  • Object
show all
Defined in:
lib/rdoc/ruby_token.rb

Instance Attribute Summary collapse

Attributes inherited from Token

#char_no, #line_no, #seek

Instance Method Summary collapse

Constructor Details

#initialize(seek, line_no, char_no, value = nil) ⇒ TkVal

Returns a new instance of TkVal.



131
132
133
134
# File 'lib/rdoc/ruby_token.rb', line 131

def initialize(seek, line_no, char_no, value = nil)
  super(seek, line_no, char_no)
  @value = value
end

Instance Attribute Details

#valueObject Also known as: text

Returns the value of attribute value.



135
136
137
# File 'lib/rdoc/ruby_token.rb', line 135

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



137
138
139
140
141
142
# File 'lib/rdoc/ruby_token.rb', line 137

def ==(other)
  self.class == other.class and
  other.line_no == @line_no and
  other.char_no == @char_no and
  other.value == @value
end

#inspectObject

:nodoc:



151
152
153
154
# File 'lib/rdoc/ruby_token.rb', line 151

def inspect # :nodoc:
  klass = self.class.name.split('::').last
  "{%s %s, %d:%d %p}" % [klass, @seek, @line_no, @char_no, @value]
end

#set_text(text) ⇒ Object



144
145
146
147
# File 'lib/rdoc/ruby_token.rb', line 144

def set_text text
  @value = text
  self
end