Class: Cuenote::Api::Node
Direct Known Subclasses
Instance Method Summary collapse
- #attributes ⇒ Object
- #elements ⇒ Object
-
#initialize(doc = nil) ⇒ Node
constructor
A new instance of Node.
Methods inherited from Base
connection, #connection, run, #run
Constructor Details
#initialize(doc = nil) ⇒ Node
Returns a new instance of Node.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/cuenote/api/node.rb', line 7 def initialize(doc=nil) @doc = case doc when REXML::Element doc when String REXML::Document.new(doc) else REXML::Document.new('<a/>') end end |
Instance Method Details
#attributes ⇒ Object
19 20 21 22 23 24 |
# File 'lib/cuenote/api/node.rb', line 19 def attributes @attributes ||= @doc.attributes.inject({}) do |hash, attr| hash[attr[0].to_sym] = attr[1] hash end end |
#elements ⇒ Object
26 27 28 |
# File 'lib/cuenote/api/node.rb', line 26 def elements @doc.elements end |