Class: DJNML::Modification::XMLText
- Inherits:
-
Object
- Object
- DJNML::Modification::XMLText
- Defined in:
- lib/djnml/modification.rb
Instance Attribute Summary collapse
-
#html ⇒ Object
readonly
Returns the value of attribute html.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(data) ⇒ XMLText
constructor
A new instance of XMLText.
- #to_s ⇒ Object
Constructor Details
#initialize(data) ⇒ XMLText
Returns a new instance of XMLText.
94 95 96 97 98 99 100 101 102 |
# File 'lib/djnml/modification.rb', line 94 def initialize(data) if data.is_a?(Nokogiri::XML::Element) @text = data.children.text.strip @html = data.children.to_xml elsif data.is_a?(Hash) @text = data['text'] @html = data['html'] end end |
Instance Attribute Details
#html ⇒ Object (readonly)
Returns the value of attribute html.
92 93 94 |
# File 'lib/djnml/modification.rb', line 92 def html @html end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
92 93 94 |
# File 'lib/djnml/modification.rb', line 92 def text @text end |
Instance Method Details
#to_s ⇒ Object
104 105 106 |
# File 'lib/djnml/modification.rb', line 104 def to_s @text.to_s end |