lib/graphql/language/token.rb in graphql-1.7.14 vs lib/graphql/language/token.rb in graphql-1.8.0.pre1
- old
+ new
@@ -3,32 +3,25 @@
module Language
# Emitted by the lexer and passed to the parser.
# Contains type, value and position data.
class Token
# @return [Symbol] The kind of token this is
- attr_reader :name
- # @return [String] The text of this token
- attr_reader :value
- attr_reader :prev_token, :line, :col
+ attr_reader :name, :prev_token, :line
def initialize(value:, name:, line:, col:, prev_token:)
@name = name
- @value = value.freeze
+ @value = value
@line = line
@col = col
@prev_token = prev_token
end
- alias to_s value
+ def to_s; @value; end
def to_i; @value.to_i; end
def to_f; @value.to_f; end
def line_and_column
[@line, @col]
- end
-
- def inspect
- "(#{@name} #{@value.inspect} [#{@line}:#{@col}])"
end
end
end
end