Class: BetterHtml::Tokenizer::Token

Inherits:
Object
  • Object
show all
Defined in:
lib/better_html/tokenizer/token.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, loc:) ⇒ Token

Returns a new instance of Token.



8
9
10
11
# File 'lib/better_html/tokenizer/token.rb', line 8

def initialize(type:, loc:)
  @type = type
  @loc = loc
end

Instance Attribute Details

#locObject (readonly)

Returns the value of attribute loc.



6
7
8
# File 'lib/better_html/tokenizer/token.rb', line 6

def loc
  @loc
end

#typeObject (readonly)

Returns the value of attribute type.



6
7
8
# File 'lib/better_html/tokenizer/token.rb', line 6

def type
  @type
end

Instance Method Details

#inspectObject



13
14
15
# File 'lib/better_html/tokenizer/token.rb', line 13

def inspect
  "t(#{type.inspect}, #{loc&.source.inspect})"
end