Class: Nanoc::Core::PrefixedDataSource

Inherits:
DataSource
  • Object
show all
Defined in:
lib/nanoc/core/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, #new_item, #new_layout, #unuse, #up, #use

Constructor Details

#initialize(data_source, items_prefix, layouts_prefix) ⇒ PrefixedDataSource

Returns a new instance of PrefixedDataSource.



6
7
8
9
10
11
12
# File 'lib/nanoc/core/prefixed_data_source.rb', line 6

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

#item_changesObject



22
23
24
# File 'lib/nanoc/core/prefixed_data_source.rb', line 22

def item_changes
  @data_source.item_changes
end

#itemsObject



14
15
16
# File 'lib/nanoc/core/prefixed_data_source.rb', line 14

def items
  @data_source.items.map { |d| d.with_identifier_prefix(@items_prefix) }
end

#layout_changesObject



26
27
28
# File 'lib/nanoc/core/prefixed_data_source.rb', line 26

def layout_changes
  @data_source.layout_changes
end

#layoutsObject



18
19
20
# File 'lib/nanoc/core/prefixed_data_source.rb', line 18

def layouts
  @data_source.layouts.map { |d| d.with_identifier_prefix(@layouts_prefix) }
end