Class: Grid::Config
- Inherits:
-
Object
- Object
- Grid::Config
- Defined in:
- lib/grid/config.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Config
constructor
A new instance of Config.
- #method_missing(method, *args, &block) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Config
Returns a new instance of Config.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/grid/config.rb', line 5 def initialize( = {}) self.data = { grid_system: :foundation, class_names: { foundation: { large: 'large-', medium: 'medium-', small: 'small-' }, bootstrap: { large: 'col-lg-', medium: 'col-md-', small: 'col-sm-', xsmall: 'col-xs-' } } } merge() end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/grid/config.rb', line 26 def method_missing(method, *args, &block) if method.to_s.include?('=') self.data[method.to_s.sub('=','').to_sym] = args.first elsif data.has_key?(method) data[method] end end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
3 4 5 |
# File 'lib/grid/config.rb', line 3 def data @data end |