Class: Entitlements::Data::Groups::Calculated::Modifiers::Expiration
- Includes:
- Contracts::Core
- Defined in:
- lib/entitlements/data/groups/calculated/modifiers/expiration.rb
Constant Summary collapse
- C =
::Contracts
Instance Method Summary collapse
Methods included from Contracts::Core
Methods inherited from Base
Constructor Details
This class inherits a constructor from Entitlements::Data::Groups::Calculated::Modifiers::Base
Instance Method Details
#modify(result) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/entitlements/data/groups/calculated/modifiers/expiration.rb', line 24 def modify(result) return false if Entitlements.config.fetch("ignore_expirations", false) # If group is already empty, we have nothing to consider modifying, regardless # of expiration date. Just return false right away. if result.empty? return false end # If the date is in the future, leave the entitlement unchanged. return false if parse_date > Time.now.utc.to_date # Empty the group. Set metadata allowing no members. Return true to indicate modification. rs.["no_members_ok"] = true result.clear true end |