class HTML5::Token
- HTML5::Token
- Reference
- Object
Overview
A Token consists of a TokenType and some data (tag name for start and end tags, content for text, comments and doctypes). A tag Token may also contain an array of Attributes. data is unescaped for all Tokens (it looks like "a<b" rather than "a<b"). For tag Tokens, data_atom is the atom for data, or zero if data is not a known tag name.
Defined in:
html5/token.crConstructors
Instance Method Summary
- #attr : Array(Attribute)
- #attr=(attr : Array(Attribute))
- #data : String
- #data=(data : String)
- #data_atom : Atom::Atom
- #data_atom=(data_atom : Atom::Atom)
-
#tag_string
returns a string representation of a tag Token's data and attr
-
#to_s(io : IO) : Nil
Appends a short String representation of this object which includes its class name and its object address.
-
#to_s
Returns a nicely readable and concise string representation of this object, typically intended for users.
- #type : TokenType
- #type=(type : TokenType)
Constructor Detail
def self.new(type : HTML5::TokenType = TokenType::Error, data_atom : HTML5::Atom::Atom = Atom::Atom.zero, data : String = "", attr : Array(HTML5::Attribute) = Array(Attribute).new(0))
#
Instance Method Detail
def to_s(io : IO) : Nil
#
Description copied from class Reference
Appends a short String representation of this object which includes its class name and its object address.
class Person
def initialize(@name : String, @age : Int32)
end
end
Person.new("John", 32).to_s # => #<Person:0x10a199f20>