Class: Munge::Conglomerate
- Inherits:
-
Object
- Object
- Munge::Conglomerate
show all
- Defined in:
- lib/munge/conglomerate.rb,
lib/munge/conglomerate/reader.rb,
lib/munge/conglomerate/router.rb,
lib/munge/conglomerate/processor.rb,
lib/munge/conglomerate/collection.rb,
lib/munge/conglomerate/item_factory.rb,
lib/munge/conglomerate/router/itemish.rb,
lib/munge/conglomerate/item_factory/content_parser.rb,
lib/munge/conglomerate/item_factory/item_identifier.rb
Defined Under Namespace
Classes: Collection, ItemFactory, Processor, Reader, Router
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(root_path, config) ⇒ Conglomerate
Returns a new instance of Conglomerate.
3
4
5
6
|
# File 'lib/munge/conglomerate.rb', line 3
def initialize(root_path, config)
@root_path = root_path
@config = config
end
|
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
65
66
67
|
# File 'lib/munge/conglomerate.rb', line 65
def config
@config
end
|
Instance Method Details
#global_data ⇒ Object
55
56
57
58
59
60
61
62
63
|
# File 'lib/munge/conglomerate.rb', line 55
def global_data
if @global_data.nil?
data_path = File.expand_path(@config[:data_path], @root_path)
loaded_file = YAML.load_file(data_path) || {}
@global_data = Munge::Util::SymbolHash.deep_convert(loaded_file)
end
@global_data
end
|
#item_factory ⇒ Object
8
9
10
11
12
13
14
|
# File 'lib/munge/conglomerate.rb', line 8
def item_factory
@item_factory ||=
ItemFactory.new(
text_extensions: @config[:items_text_extensions],
ignore_extensions: @config[:items_ignore_extensions]
)
end
|
#items ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/munge/conglomerate.rb', line 16
def items
return @items if @items
source_path = File.expand_path(@config[:source_path], @root_path)
vfs = Vfs::Filesystem.new(source_path)
@items =
Collection.new(
items: Reader.new(vfs, item_factory)
)
end
|
#layouts ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/munge/conglomerate.rb', line 28
def layouts
if @layouts.nil?
layouts_path = File.expand_path(@config[:layouts_path], @root_path)
vfs = Vfs::Filesystem.new(layouts_path)
@layouts =
Collection.new(
items: Reader.new(vfs, item_factory)
)
@layouts.each(&:transform)
end
@layouts
end
|
#processor ⇒ Object
44
45
46
|
# File 'lib/munge/conglomerate.rb', line 44
def processor
@processor ||= Processor.new(self)
end
|
#router ⇒ Object
48
49
50
51
52
53
|
# File 'lib/munge/conglomerate.rb', line 48
def router
@router ||=
Router.new(
processor: processor
)
end
|