Class: Markbridge::Parsers::BBCode::TextToken

Inherits:
Token
  • Object
show all
Defined in:
lib/markbridge/parsers/bbcode/tokens/text_token.rb

Overview

Token representing text content

Instance Attribute Summary collapse

Attributes inherited from Token

#pos

Instance Method Summary collapse

Constructor Details

#initialize(text:, pos: 0) ⇒ TextToken

Returns a new instance of TextToken.



10
11
12
13
# File 'lib/markbridge/parsers/bbcode/tokens/text_token.rb', line 10

def initialize(text:, pos: 0)
  super(pos:, source: text)
  @text = text.freeze
end

Instance Attribute Details

#textObject (readonly) Also known as: source

Returns the value of attribute text.



8
9
10
# File 'lib/markbridge/parsers/bbcode/tokens/text_token.rb', line 8

def text
  @text
end

Instance Method Details

#inspectObject



17
18
19
# File 'lib/markbridge/parsers/bbcode/tokens/text_token.rb', line 17

def inspect
  "#<TextToken #{text.inspect}>"
end