Class: Odania::Config::Internal
- Inherits:
-
Object
- Object
- Odania::Config::Internal
- Defined in:
- lib/odania/config/internal.rb
Instance Attribute Summary collapse
-
#layouts ⇒ Object
Returns the value of attribute layouts.
-
#partials ⇒ Object
Returns the value of attribute partials.
Instance Method Summary collapse
- #assets ⇒ Object
- #dump ⇒ Object
-
#initialize ⇒ Internal
constructor
A new instance of Internal.
- #load(data, group_name) ⇒ Object
- #reset ⇒ Object
Constructor Details
#initialize ⇒ Internal
Returns a new instance of Internal.
6 7 8 |
# File 'lib/odania/config/internal.rb', line 6 def initialize reset end |
Instance Attribute Details
#layouts ⇒ Object
Returns the value of attribute layouts.
4 5 6 |
# File 'lib/odania/config/internal.rb', line 4 def layouts @layouts end |
#partials ⇒ Object
Returns the value of attribute partials.
4 5 6 |
# File 'lib/odania/config/internal.rb', line 4 def partials @partials end |
Instance Method Details
#assets ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/odania/config/internal.rb', line 10 def assets result = {} self.layouts.each_pair do |_name, layout| layout.assets.each_pair do |key, val| result[key] = val end end result end |
#dump ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/odania/config/internal.rb', line 35 def dump partial_data = {} partials.each_pair do |web_url, page| partial_data[web_url] = page.dump end layout_data = {} layouts.each_pair do |web_url, page| layout_data[web_url] = page.dump end { 'layouts' => layout_data, 'partials' => partial_data } end |
#load(data, group_name) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/odania/config/internal.rb', line 20 def load(data, group_name) reset unless data['partials'].nil? data['partials'].each_pair do |name, partial_data| self.partials[name].load(partial_data) end end unless data['layouts'].nil? data['layouts'].each_pair do |name, layout_data| self.layouts[name].load(layout_data, group_name) end end end |