Class: Dbxml::XmlResults
Overview
Wraps the XmlResults class as an enumerable collection of XmlValue or XmlDocument.
Instance Method Summary collapse
-
#each(&block) ⇒ Object
Iterates across each result (as an XmlValue) in the set.
-
#each_doc(&block) ⇒ Object
Iterates across each result (as an XmlDocument) in the set.
-
#first ⇒ Object
Returns the first result as an XmlValue(or
nil
). -
#first_doc ⇒ Object
Returns the first result as an XmlDocument (or
nil
). -
#to_s ⇒ Object
Returns the result set as
newline
-joined strings.
Instance Method Details
#each(&block) ⇒ Object
Iterates across each result (as an XmlValue) in the set
70 71 72 73 74 75 |
# File 'lib/rdbxml.rb', line 70 def each( &block ) # :yields: value self.reset while self.hasNext yield self.next end end |
#each_doc(&block) ⇒ Object
Iterates across each result (as an XmlDocument) in the set
78 79 80 81 82 83 |
# File 'lib/rdbxml.rb', line 78 def each_doc( &block ) # :yields: document self.reset while self.hasNext yield self.nextDocument end end |
#first ⇒ Object
Returns the first result as an XmlValue(or nil
)
86 87 88 89 |
# File 'lib/rdbxml.rb', line 86 def first self.reset self.hasNext ? self.next : nil end |
#first_doc ⇒ Object
Returns the first result as an XmlDocument (or nil
)
92 93 94 95 |
# File 'lib/rdbxml.rb', line 92 def first_doc self.reset self.hasNext ? self.nextDocument : nil end |
#to_s ⇒ Object
Returns the result set as newline
-joined strings
98 99 100 |
# File 'lib/rdbxml.rb', line 98 def to_s collect { |v| v.to_s }.join "\n" end |