Class: DeadSimpleCMS::Group
- Inherits:
-
Attribute::Collection
- Object
- Attribute::Collection
- DeadSimpleCMS::Group
- Includes:
- Presenter::RenderMixin
- Defined in:
- lib/dead_simple_cms/group.rb,
lib/dead_simple_cms/group/configuration.rb,
lib/dead_simple_cms/group/presenter/base.rb,
lib/dead_simple_cms/group/presenter/render_mixin.rb
Overview
Public: A Group is essentially an Attribute::Collection with the ability to have it’s own groups on it with infinite nesting of groups.
Direct Known Subclasses
Defined Under Namespace
Modules: Presenter Classes: Configuration
Constant Summary collapse
- ROOT_IDENTIFIER =
:root
Instance Attribute Summary collapse
-
#groups ⇒ Object
readonly
Returns the value of attribute groups.
-
#parent ⇒ Object
Returns the value of attribute parent.
Attributes inherited from Attribute::Collection
Class Method Summary collapse
Instance Method Summary collapse
- #add_group(group) ⇒ Object
-
#extend(*modules, &block) ⇒ Object
Public: Exend functionality for the current group.
-
#initialize(identifier, options = {}) ⇒ Group
constructor
A new instance of Group.
- #root? ⇒ Boolean
Methods included from Presenter::RenderMixin
#display, #presenter_class, #render, #render_proc
Methods inherited from Attribute::Collection
#add_attribute, #persisted?, #update_attributes
Constructor Details
#initialize(identifier, options = {}) ⇒ Group
Returns a new instance of Group.
14 15 16 17 |
# File 'lib/dead_simple_cms/group.rb', line 14 def initialize(identifier, ={}) @groups = DeadSimpleCMS::Group.new_dictionary super end |
Instance Attribute Details
#groups ⇒ Object (readonly)
Returns the value of attribute groups.
8 9 10 |
# File 'lib/dead_simple_cms/group.rb', line 8 def groups @groups end |
#parent ⇒ Object
Returns the value of attribute parent.
9 10 11 |
# File 'lib/dead_simple_cms/group.rb', line 9 def parent @parent end |
Class Method Details
.root ⇒ Object
19 20 21 |
# File 'lib/dead_simple_cms/group.rb', line 19 def self.root new(ROOT_IDENTIFIER) end |
Instance Method Details
#add_group(group) ⇒ Object
33 34 35 36 37 |
# File 'lib/dead_simple_cms/group.rb', line 33 def add_group(group) group.parent = self groups.add(group) group_accessor(group) end |
#extend(*modules, &block) ⇒ Object
Public: Exend functionality for the current group.
24 25 26 27 |
# File 'lib/dead_simple_cms/group.rb', line 24 def extend(*modules, &block) modules << Module.new(&block) if block_given? super(*modules) end |
#root? ⇒ Boolean
29 30 31 |
# File 'lib/dead_simple_cms/group.rb', line 29 def root? identifier == ROOT_IDENTIFIER end |