Class: XML::Smart::Dom::Text
- Inherits:
-
Object
- Object
- XML::Smart::Dom::Text
- Defined in:
- lib/xml/smart_domtext.rb
Direct Known Subclasses
Instance Method Summary collapse
- #===(cls) ⇒ Object
- #dump ⇒ Object
-
#initialize(text) ⇒ Text
constructor
A new instance of Text.
- #parent ⇒ Object
- #path ⇒ Object
- #text ⇒ Object
- #text=(t) ⇒ Object
- #to_f ⇒ Object
- #to_i ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(text) ⇒ Text
Returns a new instance of Text.
6 |
# File 'lib/xml/smart_domtext.rb', line 6 def initialize(text); @node = text; end |
Instance Method Details
#===(cls) ⇒ Object
8 |
# File 'lib/xml/smart_domtext.rb', line 8 def ===(cls); self.is_a? cls; end |
#dump ⇒ Object
10 |
# File 'lib/xml/smart_domtext.rb', line 10 def dump; to_s; end |
#parent ⇒ Object
18 |
# File 'lib/xml/smart_domtext.rb', line 18 def parent; Node.new(@node.parent); end |
#path ⇒ Object
20 |
# File 'lib/xml/smart_domtext.rb', line 20 def path; @node.path; end |
#text ⇒ Object
15 |
# File 'lib/xml/smart_domtext.rb', line 15 def text; @node.content; end |
#text=(t) ⇒ Object
16 |
# File 'lib/xml/smart_domtext.rb', line 16 def text=(t); @node.content = t.to_s if t.respond_to? :to_s; end |
#to_f ⇒ Object
12 |
# File 'lib/xml/smart_domtext.rb', line 12 def to_f; @node.content.to_f; end |
#to_i ⇒ Object
13 |
# File 'lib/xml/smart_domtext.rb', line 13 def to_i; @node.content.to_i; end |
#to_s ⇒ Object
11 |
# File 'lib/xml/smart_domtext.rb', line 11 def to_s; @node.content.to_s; end |