Module: ActiveRegulation::Activation
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/active_regulation/activation.rb
Instance Method Summary collapse
- #active! ⇒ Object
- #active? ⇒ Boolean
- #inactivated_at_or_time ⇒ Object
- #inactive! ⇒ Object
- #inactive? ⇒ Boolean
- #to_activation ⇒ Object
Instance Method Details
#active! ⇒ Object
12 13 14 |
# File 'lib/active_regulation/activation.rb', line 12 def active! update(inactivated_at: nil) if inactive? end |
#active? ⇒ Boolean
20 21 22 |
# File 'lib/active_regulation/activation.rb', line 20 def active? inactivated_at.nil? end |
#inactivated_at_or_time ⇒ Object
28 29 30 |
# File 'lib/active_regulation/activation.rb', line 28 def inactivated_at_or_time active? ? Time.current : inactivated_at end |
#inactive! ⇒ Object
16 17 18 |
# File 'lib/active_regulation/activation.rb', line 16 def inactive! update(inactivated_at: Time.current) if active? end |
#inactive? ⇒ Boolean
24 25 26 |
# File 'lib/active_regulation/activation.rb', line 24 def inactive? !active? end |
#to_activation ⇒ Object
32 33 34 |
# File 'lib/active_regulation/activation.rb', line 32 def to_activation I18n.t("active_regulation.activation.#{active? ? :active : :inactive}") end |