Class: Semlogr::Templates::TextToken

Inherits:
Object
  • Object
show all
Defined in:
lib/semlogr/templates/text_token.rb

Constant Summary collapse

EMPTY =
TextToken.new('')

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text) ⇒ TextToken

Returns a new instance of TextToken.



8
9
10
# File 'lib/semlogr/templates/text_token.rb', line 8

def initialize(text)
  @text = text
end

Instance Attribute Details

#textObject

Returns the value of attribute text.



6
7
8
# File 'lib/semlogr/templates/text_token.rb', line 6

def text
  @text
end

Instance Method Details

#==(other) ⇒ Object



16
17
18
19
20
21
# File 'lib/semlogr/templates/text_token.rb', line 16

def ==(other)
  return false unless other
  return false unless other.respond_to?(:text)

  @text == other.text
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/semlogr/templates/text_token.rb', line 23

def eql?(other)
  self == other
end

#hashObject



27
28
29
# File 'lib/semlogr/templates/text_token.rb', line 27

def hash
  @text.hash
end

#render(output, _properties) ⇒ Object



12
13
14
# File 'lib/semlogr/templates/text_token.rb', line 12

def render(output, _properties)
  output << @text
end