Class: RDoc::RubyToken::Token

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

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Token) initialize(seek, line_no, char_no, text = nil)

A new instance of Token



34
35
36
37
38
39
# File 'lib/rdoc/ruby_token.rb', line 34

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

Instance Attribute Details

- (Object) char_no (readonly)

Returns the value of attribute char_no



43
44
45
# File 'lib/rdoc/ruby_token.rb', line 43

def char_no
  @char_no
end

- (Object) line_no (readonly)

Returns the value of attribute line_no



42
43
44
# File 'lib/rdoc/ruby_token.rb', line 42

def line_no
  @line_no
end

- (Object) seek (readonly)

Returns the value of attribute seek



41
42
43
# File 'lib/rdoc/ruby_token.rb', line 41

def seek
  @seek
end

- (Object) text

Returns the value of attribute text



45
46
47
# File 'lib/rdoc/ruby_token.rb', line 45

def text
  @text
end

Instance Method Details

- (Object) ==(other)



47
48
49
50
51
52
# File 'lib/rdoc/ruby_token.rb', line 47

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

- (Object) set_text(text)

Because we're used in contexts that expect to return a token, we set the text string and then return ourselves



58
59
60
61
# File 'lib/rdoc/ruby_token.rb', line 58

def set_text(text)
  @text = text
  self
end