Module: GroupedReader::InstanceMethods
- Defined in:
- lib/grouped_reader.rb
Instance Method Summary collapse
-
#activate_with_group! ⇒ Object
if group-welcome messages exist for this reader’s memberships, they will be sent on activation.
- #can_see?(this) ⇒ Boolean
- #find_homepage ⇒ Object
-
#has_group?(group = nil) ⇒ Boolean
has_group? is ambiguous: with no argument it means ‘is this reader grouped at all?’.
- #in_any_of_these_groups?(grouplist) ⇒ Boolean
- #is_in?(group) ⇒ Boolean
-
#send_functional_message_with_group(function, group = nil) ⇒ Object
there may be versions of the functional (eg welcome) messages specific to a group (which has to be passed through, so this currently only happens when sending out group invitations but ought to be useful elsewhere too).
- #send_group_invitation_message(group = nil) ⇒ Object
Instance Method Details
#activate_with_group! ⇒ Object
if group-welcome messages exist for this reader’s memberships, they will be sent on activation
51 52 53 |
# File 'lib/grouped_reader.rb', line 51 def activate_with_group! send_group_welcomes if activate_without_group! end |
#can_see?(this) ⇒ Boolean
32 33 34 35 |
# File 'lib/grouped_reader.rb', line 32 def can_see? (this) permitted_groups = this.permitted_groups permitted_groups.empty? or in_any_of_these_groups?(permitted_groups) end |
#find_homepage ⇒ Object
26 27 28 29 30 |
# File 'lib/grouped_reader.rb', line 26 def find_homepage if homegroup = groups.with_home_page.first homegroup.homepage end end |
#has_group?(group = nil) ⇒ Boolean
has_group? is ambiguous: with no argument it means ‘is this reader grouped at all?’.
46 47 48 |
# File 'lib/grouped_reader.rb', line 46 def has_group?(group=nil) group.nil? ? groups.any? : is_in?(group) end |
#in_any_of_these_groups?(grouplist) ⇒ Boolean
37 38 39 |
# File 'lib/grouped_reader.rb', line 37 def in_any_of_these_groups? (grouplist) (grouplist & groups).any? end |
#is_in?(group) ⇒ Boolean
41 42 43 |
# File 'lib/grouped_reader.rb', line 41 def is_in? (group) groups.include?(group) end |
#send_functional_message_with_group(function, group = nil) ⇒ Object
there may be versions of the functional (eg welcome) messages specific to a group (which has to be passed through, so this currently only happens when sending out group invitations but ought to be useful elsewhere too)
57 58 59 60 61 |
# File 'lib/grouped_reader.rb', line 57 def (function, group=nil) reset_perishable_token! = Message.functional(function, group) # returns the standard functional message if no group is supplied, or no group message exists .deliver_to(self) if end |
#send_group_invitation_message(group = nil) ⇒ Object
63 64 65 |
# File 'lib/grouped_reader.rb', line 63 def (group=nil) ('invitation', group) end |