Class: Nanoc::Int::PrefixedDataSource
- Inherits:
-
DataSource
- Object
- DataSource
- Nanoc::Int::PrefixedDataSource
- Defined in:
- lib/nanoc/base/repos/prefixed_data_source.rb
Instance Attribute Summary
Attributes inherited from DataSource
#config, #items_root, #layouts_root
Instance Method Summary collapse
-
#initialize(data_source, items_prefix, layouts_prefix) ⇒ PrefixedDataSource
constructor
A new instance of PrefixedDataSource.
-
#items ⇒ Object
-
#layouts ⇒ Object
Methods inherited from DataSource
#down, #new_item, #new_layout, #unuse, #up, #use
Constructor Details
#initialize(data_source, items_prefix, layouts_prefix) ⇒ PrefixedDataSource
Returns a new instance of PrefixedDataSource
5 6 7 8 9 10 11 |
# File 'lib/nanoc/base/repos/prefixed_data_source.rb', line 5 def initialize(data_source, items_prefix, layouts_prefix) super({}, '/', '/', {}) @data_source = data_source @items_prefix = items_prefix @layouts_prefix = layouts_prefix end |
Instance Method Details
#items ⇒ Object
13 14 15 |
# File 'lib/nanoc/base/repos/prefixed_data_source.rb', line 13 def items @data_source.items.map { |d| d.with_identifier_prefix(@items_prefix) } end |
#layouts ⇒ Object
17 18 19 |
# File 'lib/nanoc/base/repos/prefixed_data_source.rb', line 17 def layouts @data_source.layouts.map { |d| d.with_identifier_prefix(@layouts_prefix) } end |