Class: ActiveDocument::Base::PartialResult
- Inherits:
-
ActiveDocument::Base
- Object
- Finder
- ActiveDocument::Base
- ActiveDocument::Base::PartialResult
- Includes:
- Enumerable
- Defined in:
- lib/ActiveDocument/active_document.rb
Overview
end inner class
Instance Attribute Summary
Attributes inherited from ActiveDocument::Base
#document, #my_attribute_namespaces, #my_default_attribute_namespaces, #my_default_namespace, #my_namespaces, #root, #uri
Instance Method Summary collapse
-
#[](index) ⇒ Object
provides access to an indexed node.
-
#children ⇒ Object
provides access to the child nodes.
- #each(&block) ⇒ Object
-
#initialize(nodeset, parent) ⇒ PartialResult
constructor
todo should this contain a reference to its parent?.
-
#length ⇒ Object
returns the number of Nodes in the underlying NodeSet.
- #text ⇒ Object
Methods inherited from ActiveDocument::Base
#[]=, add_attribute_namespace, add_namespace, attribute_namespaces, default_attribute_namespace, delete, find_by_word, load, #method_missing, method_missing, namespace_for_attribute, namespace_for_element, remove_attribute_namespace, remove_namespace, #save, #to_s
Methods included from ClassLevelInheritableAttributes
Methods inherited from Finder
co_occurrence, config, execute_attribute_finder, execute_finder, method_missing, search
Constructor Details
#initialize(nodeset, parent) ⇒ PartialResult
todo should this contain a reference to its parent?
282 283 284 285 286 287 288 289 290 291 292 |
# File 'lib/ActiveDocument/active_document.rb', line 282 def initialize(nodeset, parent) @document = nodeset @root = if nodeset.instance_of? Nokogiri::XML::Element then nodeset.name else nodeset[0].name end @my_namespaces = parent.class.my_namespaces @my_default_namespace = parent.class.my_default_namespace end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ActiveDocument::Base
Instance Method Details
#[](index) ⇒ Object
provides access to an indexed node
305 306 307 |
# File 'lib/ActiveDocument/active_document.rb', line 305 def [](index) @document[index] end |
#children ⇒ Object
provides access to the child nodes
300 301 302 |
# File 'lib/ActiveDocument/active_document.rb', line 300 def children @document.children end |
#each(&block) ⇒ Object
313 314 315 |
# File 'lib/ActiveDocument/active_document.rb', line 313 def each(& block) @document.each(& block) end |
#length ⇒ Object
returns the number of Nodes in the underlying NodeSet
295 296 297 |
# File 'lib/ActiveDocument/active_document.rb', line 295 def length @document.length end |
#text ⇒ Object
309 310 311 |
# File 'lib/ActiveDocument/active_document.rb', line 309 def text @document.text end |