Class: Cuenote::Api::Node
- Inherits:
-
Base
- Object
- Base
- Cuenote::Api::Node
show all
- Defined in:
- lib/cuenote/api/node.rb
Instance Method Summary
collapse
Methods inherited from Base
connection, #connection, run, #run
Constructor Details
#initialize(doc = nil) ⇒ 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
|