Module: Sunrise::Config::HasGroups
Instance Method Summary collapse
-
#group(name, options = nil, &block) ⇒ Object
Accessor for a group.
-
#groups ⇒ Object
Reader for groups.
-
#visible_groups ⇒ Object
Reader for groups that are marked as visible.
Instance Method Details
#group(name, options = nil, &block) ⇒ Object
Accessor for a group
If group with given name does not yet exist it will be created. If a block is passed it will be evaluated in the context of the group
10 11 12 13 14 |
# File 'lib/sunrise/config/has_groups.rb', line 10 def group(name, = nil, &block) groups[name] ||= Sunrise::Config::Group.new(abstract_model, self, name, ) groups[name].instance_eval &block if block groups[name] end |
#groups ⇒ Object
Reader for groups
17 18 19 |
# File 'lib/sunrise/config/has_groups.rb', line 17 def groups @groups ||= {} end |
#visible_groups ⇒ Object
Reader for groups that are marked as visible
22 23 24 |
# File 'lib/sunrise/config/has_groups.rb', line 22 def visible_groups groups.select {|g| g.visible? } end |