Class: Odania::Config::Layout
- Inherits:
-
Object
- Object
- Odania::Config::Layout
- Defined in:
- lib/odania/config/layout.rb
Instance Attribute Summary collapse
-
#styles ⇒ Object
Returns the value of attribute styles.
Instance Method Summary collapse
- #assets ⇒ Object
- #dump ⇒ Object
-
#initialize ⇒ Layout
constructor
A new instance of Layout.
- #load(data, group_name) ⇒ Object
- #reset ⇒ Object
Constructor Details
#initialize ⇒ Layout
Returns a new instance of Layout.
6 7 8 |
# File 'lib/odania/config/layout.rb', line 6 def initialize reset end |
Instance Attribute Details
#styles ⇒ Object
Returns the value of attribute styles.
4 5 6 |
# File 'lib/odania/config/layout.rb', line 4 def styles @styles end |
Instance Method Details
#assets ⇒ Object
10 11 12 13 |
# File 'lib/odania/config/layout.rb', line 10 def assets return {} if self.styles['_general'].nil? or self.styles['_general'].assets.nil? self.styles['_general'].assets end |
#dump ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/odania/config/layout.rb', line 15 def dump style_data = {} styles.each_pair do |name, style| style_data[name] = style.dump end result = {} result['styles'] =style_data unless style_data.nil? result end |
#load(data, group_name) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/odania/config/layout.rb', line 26 def load(data, group_name) reset unless data['styles'].nil? data['styles'].each_pair do |key, val| self.styles[key].load(val, group_name) end end end |
#reset ⇒ Object
35 36 37 |
# File 'lib/odania/config/layout.rb', line 35 def reset self.styles = Hash.new { |hash, key| hash[key] = Style.new(key) } end |