Module: GroupedPage::InstanceMethods

Defined in:
lib/grouped_page.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#inherited_groupsObject (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

Returns:

  • (Boolean)


37
38
39
# File 'lib/grouped_page.rb', line 37

def cache_with_restrictions?
  cache_without_restrictions? && !restricted?
end

#group_ids_with_inheritanceObject



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

Returns:

  • (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

Returns:

  • (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_idsObject

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

Returns:

  • (Boolean)


33
34
35
# File 'lib/grouped_page.rb', line 33

def restricted?
  self.groups.any?
end