Module: GroupedPage::InstanceMethods
- Defined in:
- lib/grouped_page.rb
Instance Attribute Summary collapse
-
#inherited_groups ⇒ Object
readonly
Returns the value of attribute inherited_groups.
Instance Method Summary collapse
- #cache_with_restrictions? ⇒ Boolean
- #group_ids_with_inheritance ⇒ Object
- #group_is_inherited?(group) ⇒ Boolean
- #has_inherited_group?(group) ⇒ Boolean
-
#inherited_group_ids ⇒ Object
If a grandparent page is associated with a supergroup page then all of the descendant pages are bound to all of the descendant groups.
-
#restricted? ⇒ Boolean
this is regrettably expensive and I plan to replace it with a private? setter that would be cascaded on page update.
Instance Attribute Details
#inherited_groups ⇒ Object (readonly)
Returns the value of attribute inherited_groups.
15 16 17 |
# File 'lib/grouped_page.rb', line 15 def inherited_groups @inherited_groups end |
Instance Method Details
#cache_with_restrictions? ⇒ Boolean
37 38 39 |
# File 'lib/grouped_page.rb', line 37 def cache_with_restrictions? cache_without_restrictions? && !restricted? end |
#group_ids_with_inheritance ⇒ Object
26 27 28 |
# File 'lib/grouped_page.rb', line 26 def group_ids_with_inheritance (group_ids_without_inheritance + inherited_group_ids).flatten.uniq end |
#group_is_inherited?(group) ⇒ Boolean
45 46 47 |
# File 'lib/grouped_page.rb', line 45 def group_is_inherited?(group) return self.has_inherited_group?(group) && !self.has_group?(group) end |
#has_inherited_group?(group) ⇒ Boolean
41 42 43 |
# File 'lib/grouped_page.rb', line 41 def has_inherited_group?(group) return self.inherited_groups.include?(group) end |
#inherited_group_ids ⇒ Object
If a grandparent page is associated with a supergroup page then all of the descendant pages are bound to all of the descendant groups.
22 23 24 |
# File 'lib/grouped_page.rb', line 22 def inherited_group_ids self.ancestors.map(&:group_ids).flatten.uniq end |
#restricted? ⇒ Boolean
this is regrettably expensive and I plan to replace it with a private? setter that would be cascaded on page update
33 34 35 |
# File 'lib/grouped_page.rb', line 33 def restricted? self.groups.any? end |