Class: Nanoc::Int::AggregateDataSource
- Inherits:
-
DataSource
- Object
- DataSource
- Nanoc::Int::AggregateDataSource
- Defined in:
- lib/nanoc/base/repos/aggregate_data_source.rb
Instance Attribute Summary
Attributes inherited from DataSource
#config, #items_root, #layouts_root
Instance Method Summary collapse
-
#initialize(data_sources, config) ⇒ AggregateDataSource
constructor
A new instance of AggregateDataSource.
-
#items ⇒ Object
-
#layouts ⇒ Object
Methods inherited from DataSource
#down, #loading, #new_item, #new_layout, #unuse, #up, #use
Constructor Details
#initialize(data_sources, config) ⇒ AggregateDataSource
Returns a new instance of AggregateDataSource
5 6 7 8 9 10 |
# File 'lib/nanoc/base/repos/aggregate_data_source.rb', line 5 def initialize(data_sources, config) super({}, '/', '/', {}) @data_sources = data_sources @config = config end |
Instance Method Details
#items ⇒ Object
12 13 14 15 16 17 |
# File 'lib/nanoc/base/repos/aggregate_data_source.rb', line 12 def items @_items ||= begin objs = @data_sources.flat_map(&:items) Nanoc::Int::ItemCollection.new(@config, objs) end end |
#layouts ⇒ Object
19 20 21 22 23 24 |
# File 'lib/nanoc/base/repos/aggregate_data_source.rb', line 19 def layouts @_layouts ||= begin objs = @data_sources.flat_map(&:layouts) Nanoc::Int::LayoutCollection.new(@config, objs) end end |