Class: Nanoc::Int::PrefixedDataSource

Inherits:
DataSource
  • Object
show all
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

Methods inherited from DataSource

#down, #loading, #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

#itemsObject



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

#layoutsObject



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