class RSpec::Core::Source::Token
@private A wrapper for Ripper token which is generated with `Ripper.lex`.
Attributes
token[R]
Public Class Methods
new(ripper_token)
click to toggle source
# File lib/rspec/core/source/token.rb, line 15 def initialize(ripper_token) @token = ripper_token.freeze end
tokens_from_ripper_tokens(ripper_tokens)
click to toggle source
# File lib/rspec/core/source/token.rb, line 11 def self.tokens_from_ripper_tokens(ripper_tokens) ripper_tokens.map { |ripper_token| new(ripper_token) }.freeze end
Public Instance Methods
==(other)
click to toggle source
# File lib/rspec/core/source/token.rb, line 31 def ==(other) token == other.token end
Also aliased as: eql?
inspect()
click to toggle source
# File lib/rspec/core/source/token.rb, line 37 def inspect "#<#{self.class} #{type} #{string.inspect}>" end
location()
click to toggle source
# File lib/rspec/core/source/token.rb, line 19 def location @location ||= Location.new(*token[0]) end
string()
click to toggle source
# File lib/rspec/core/source/token.rb, line 27 def string token[2] end
type()
click to toggle source
# File lib/rspec/core/source/token.rb, line 23 def type token[1] end