Class: XmlUtils::Token
- Inherits:
-
Object
- Object
- XmlUtils::Token
- Defined in:
- lib/xmlutils/tokenizer.rb
Constant Summary collapse
- TYPES =
%i[ start_tag end_tag empty_tag text cdata comment processing_instruction doctype xml_decl attribute_name attribute_value close_tag eq quote whitespace newline eof ].freeze
Instance Attribute Summary collapse
-
#line ⇒ Object
Returns the value of attribute line.
-
#position ⇒ Object
Returns the value of attribute position.
-
#type ⇒ Object
Returns the value of attribute type.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(type, value = nil, line = nil, position = nil) ⇒ Token
constructor
A new instance of Token.
- #to_s ⇒ Object
Constructor Details
#initialize(type, value = nil, line = nil, position = nil) ⇒ Token
Returns a new instance of Token.
29 30 31 32 33 34 |
# File 'lib/xmlutils/tokenizer.rb', line 29 def initialize(type, value = nil, line = nil, position = nil) @type = type @value = value @line = line @position = position end |
Instance Attribute Details
#line ⇒ Object
Returns the value of attribute line.
20 21 22 |
# File 'lib/xmlutils/tokenizer.rb', line 20 def line @line end |
#position ⇒ Object
Returns the value of attribute position.
20 21 22 |
# File 'lib/xmlutils/tokenizer.rb', line 20 def position @position end |
#type ⇒ Object
Returns the value of attribute type.
20 21 22 |
# File 'lib/xmlutils/tokenizer.rb', line 20 def type @type end |
#value ⇒ Object
Returns the value of attribute value.
20 21 22 |
# File 'lib/xmlutils/tokenizer.rb', line 20 def value @value end |
Instance Method Details
#to_s ⇒ Object
36 37 38 |
# File 'lib/xmlutils/tokenizer.rb', line 36 def to_s "<Token #{@type}: #{@value.inspect}>" end |