Class: Marcxella::Document
- Inherits:
-
Object
- Object
- Marcxella::Document
- Defined in:
- lib/marcxella/document.rb
Overview
Container for a MARC-XML document
Instance Attribute Summary collapse
-
#document ⇒ Nokigiri::XML::Document
readonly
wrapped Nokogiri document.
Instance Method Summary collapse
-
#collections ⇒ Array<Collection>
Collection elements.
-
#initialize(xml) ⇒ Document
constructor
Constructor for Document object.
-
#records ⇒ Array<Record>
Record elements.
Constructor Details
#initialize(xml) ⇒ Document
Constructor for Document object
11 12 13 14 15 16 17 |
# File 'lib/marcxella/document.rb', line 11 def initialize(xml) if xml.is_a? Nokogiri::XML::Document @document = xml else @document = Nokogiri::XML(xml) end end |
Instance Attribute Details
#document ⇒ Nokigiri::XML::Document (readonly)
wrapped Nokogiri document
6 7 8 |
# File 'lib/marcxella/document.rb', line 6 def document @document end |
Instance Method Details
#collections ⇒ Array<Collection>
Collection elements
29 30 31 |
# File 'lib/marcxella/document.rb', line 29 def collections @document.css('collection').map{|c| Collection.new(c)} end |