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.



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

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

Instance Attribute Details

#locObject (readonly)

Returns the value of attribute loc.



4
5
6
# File 'lib/better_html/tokenizer/token.rb', line 4

def loc
  @loc
end

#typeObject (readonly)

Returns the value of attribute type.



4
5
6
# File 'lib/better_html/tokenizer/token.rb', line 4

def type
  @type
end

Instance Method Details

#inspectObject



11
12
13
# File 'lib/better_html/tokenizer/token.rb', line 11

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