Class: SPDocgen::DocumentSet
- Inherits:
-
Object
- Object
- SPDocgen::DocumentSet
- Defined in:
- lib/spdocgen/document_set.rb
Instance Attribute Summary collapse
-
#data_sources ⇒ Object
readonly
Returns the value of attribute data_sources.
-
#documents ⇒ Object
Returns the value of attribute documents.
-
#xmlns ⇒ Object
readonly
Returns the value of attribute xmlns.
Instance Method Summary collapse
- #all_data_sources ⇒ Object
- #all_xmlns ⇒ Object
-
#initialize ⇒ DocumentSet
constructor
A new instance of DocumentSet.
Constructor Details
#initialize ⇒ DocumentSet
Returns a new instance of DocumentSet.
6 7 8 9 |
# File 'lib/spdocgen/document_set.rb', line 6 def initialize @xmlns = {} @data_sources = [] end |
Instance Attribute Details
#data_sources ⇒ Object (readonly)
Returns the value of attribute data_sources.
3 4 5 |
# File 'lib/spdocgen/document_set.rb', line 3 def data_sources @data_sources end |
#documents ⇒ Object
Returns the value of attribute documents.
4 5 6 |
# File 'lib/spdocgen/document_set.rb', line 4 def documents @documents end |
#xmlns ⇒ Object (readonly)
Returns the value of attribute xmlns.
3 4 5 |
# File 'lib/spdocgen/document_set.rb', line 3 def xmlns @xmlns end |
Instance Method Details
#all_data_sources ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/spdocgen/document_set.rb', line 11 def all_data_sources mapped = (data_sources + documents.collect(&:data_sources).flatten).inject({}) do |map, ds| map[ds.id] = ds map end mapped.values.sort_by(&:id) end |
#all_xmlns ⇒ Object
19 20 21 |
# File 'lib/spdocgen/document_set.rb', line 19 def all_xmlns documents.inject(@xmlns){|map, doc| map.merge(doc.xmlns)} end |