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.



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

def initialize(text)
  @text = text
end

Instance Attribute Details

#textObject

Returns the value of attribute text.



4
5
6
# File 'lib/semlogr/templates/text_token.rb', line 4

def text
  @text
end

Instance Method Details

#==(other) ⇒ Object



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

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

  @text == other.text
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/semlogr/templates/text_token.rb', line 21

def eql?(other)
  self == other
end

#hashObject



25
26
27
# File 'lib/semlogr/templates/text_token.rb', line 25

def hash
  @text.hash
end

#render(output, _properties) ⇒ Object



10
11
12
# File 'lib/semlogr/templates/text_token.rb', line 10

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