class AstBuilder::LiteralToken

Represents a literal token entity to avoid any quotation marks on inspect. Parser::AST will recursively call nodes, using `inspect` for anything that's not a `Node` type, so we can cheat to get the macro language in here.

Public Class Methods

new(string) click to toggle source
# File lib/ast_builder/literal_token.rb, line 7
def initialize(string)
  @string = string
end

Public Instance Methods

inspect() click to toggle source

Won't show quotes around it, which we need for literal tokens

@return [String]

# File lib/ast_builder/literal_token.rb, line 23
def inspect
  to_s
end
to_s() click to toggle source

Converts to a string. If we happen to have gotten some extra fun we make sure it's a string representation instead of a node.

@return [String]

# File lib/ast_builder/literal_token.rb, line 16
def to_s
  @string.to_s
end