Class: HTMLToken
- Inherits:
-
Object
- Object
- HTMLToken
- Defined in:
- lib/openid/yadis/htmltokenizer.rb
Overview
The parent class for all three types of HTML tokens
Direct Known Subclasses
Instance Attribute Summary collapse
-
#raw ⇒ Object
Returns the value of attribute raw.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Compare to another based on the raw source.
-
#initialize(text) ⇒ HTMLToken
constructor
Initialize the token based on the raw text.
-
#text ⇒ Object
By default tokens have no text representation.
-
#to_s ⇒ Object
By default, return exactly the string used to create the text.
- #trimmed_text ⇒ Object
Constructor Details
#initialize(text) ⇒ HTMLToken
Initialize the token based on the raw text
177 178 179 |
# File 'lib/openid/yadis/htmltokenizer.rb', line 177 def initialize(text) @raw = text end |
Instance Attribute Details
#raw ⇒ Object
Returns the value of attribute raw.
174 175 176 |
# File 'lib/openid/yadis/htmltokenizer.rb', line 174 def raw @raw end |
Instance Method Details
#==(other) ⇒ Object
Compare to another based on the raw source
196 197 198 |
# File 'lib/openid/yadis/htmltokenizer.rb', line 196 def ==(other) raw == other.to_s end |
#text ⇒ Object
By default tokens have no text representation
187 188 189 |
# File 'lib/openid/yadis/htmltokenizer.rb', line 187 def text "" end |
#to_s ⇒ Object
By default, return exactly the string used to create the text
182 183 184 |
# File 'lib/openid/yadis/htmltokenizer.rb', line 182 def to_s raw end |
#trimmed_text ⇒ Object
191 192 193 |
# File 'lib/openid/yadis/htmltokenizer.rb', line 191 def trimmed_text text.strip.gsub(/\s+/m, " ") end |