Module: Sunrise::Config::HasGroups

Included in:
Edit, List
Defined in:
lib/sunrise/config/has_groups.rb

Instance Method Summary collapse

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, options = nil, &block)
  groups[name] ||= Sunrise::Config::Group.new(abstract_model, self, name, options)
  groups[name].instance_eval &block if block
  groups[name]
end

#groupsObject

Reader for groups



17
18
19
# File 'lib/sunrise/config/has_groups.rb', line 17

def groups
  @groups ||= {}
end

#visible_groupsObject

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