Class: Lkml::Tokens::Token

Inherits:
Object
  • Object
show all
Defined in:
lib/lkml/tokens.rb

Constant Summary collapse

TOKEN_ID =
"<base token>"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(line_number) ⇒ Token

Returns a new instance of Token.



17
18
19
# File 'lib/lkml/tokens.rb', line 17

def initialize(line_number)
  @line_number = line_number
end

Instance Attribute Details

#line_numberObject (readonly)

Returns the value of attribute line_number.



7
8
9
# File 'lib/lkml/tokens.rb', line 7

def line_number
  @line_number
end

Instance Method Details

#==(other) ⇒ Object



21
22
23
# File 'lib/lkml/tokens.rb', line 21

def ==(other)
  instance_of?(other.class)
end

#idObject



9
10
11
# File 'lib/lkml/tokens.rb', line 9

def id
  self.class::TOKEN_ID
end

#inspectObject Also known as: to_s



25
26
27
28
29
# File 'lib/lkml/tokens.rb', line 25

def inspect
  value = respond_to?(:value) ? send(:value).to_s.strip : ""
  value = "#{value[0, 25].rstrip} ... " if value.length > 25
  "#{self.class.name.split('::').last}(#{value})"
end

#valueObject



13
14
15
# File 'lib/lkml/tokens.rb', line 13

def value
  nil
end