Class: Nanoc::Core::InMemoryDataSource

Inherits:
DataSource
  • Object
show all
Includes:
ContractsSupport
Defined in:
lib/nanoc/core/in_memory_data_source.rb

Instance Attribute Summary collapse

Attributes inherited from DataSource

#config, #items_root, #layouts_root

Instance Method Summary collapse

Methods included from ContractsSupport

enabled?, included, setup_once, warn_about_performance

Methods inherited from DataSource

#down, #new_item, #new_layout, #unuse, #up, #use

Constructor Details

#initialize(items, layouts, orig_data_source = nil) ⇒ InMemoryDataSource

Returns a new instance of InMemoryDataSource.



12
13
14
15
16
17
18
# File 'lib/nanoc/core/in_memory_data_source.rb', line 12

def initialize(items, layouts, orig_data_source = nil)
  super({}, '/', '/', {})

  @items = items
  @layouts = layouts
  @orig_data_source = orig_data_source
end

Instance Attribute Details

#itemsObject (readonly)

Returns the value of attribute items.



8
9
10
# File 'lib/nanoc/core/in_memory_data_source.rb', line 8

def items
  @items
end

#layoutsObject (readonly)

Returns the value of attribute layouts.



9
10
11
# File 'lib/nanoc/core/in_memory_data_source.rb', line 9

def layouts
  @layouts
end

Instance Method Details

#item_changesObject



20
21
22
# File 'lib/nanoc/core/in_memory_data_source.rb', line 20

def item_changes
  @orig_data_source ? @orig_data_source.item_changes : super
end

#layout_changesObject



24
25
26
# File 'lib/nanoc/core/in_memory_data_source.rb', line 24

def layout_changes
  @orig_data_source ? @orig_data_source.layout_changes : super
end