Class: Toolbox::EditConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/toolbox/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model_name, config) ⇒ EditConfig

Returns a new instance of EditConfig.



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/toolbox/config.rb', line 33

def initialize model_name, config
  @controlsets = []
  config.each do |controlset|
    raise 'The options aggregation_config and collection_config must not be defined toghether' if controlset[:collection_config] and controlset[:aggregation_config]
    h = {}
    h.merge! controlset
    h[:widget_list] = WidgetList.new(model_name, controlset[:widget_list], controlset[:widget_type] || ControlConfig)
    h[:collection_config] = CollectionConfig.new controlset[:collection_config] if controlset[:collection_config]
    h[:aggregation_config] = AggregationConfig.new controlset[:aggregation_config] if controlset[:aggregation_config]
    @controlsets << WidgetSetConfig.new(h)
  end
end

Instance Attribute Details

#controlsetsObject (readonly)

Returns the value of attribute controlsets.



31
32
33
# File 'lib/toolbox/config.rb', line 31

def controlsets
  @controlsets
end