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
10 11 12 |
# File 'lib/active_regulation/activation.rb', line 10 def active! update(inactivated_at: nil) if inactive? end |
#active? ⇒ Boolean
18 19 20 |
# File 'lib/active_regulation/activation.rb', line 18 def active? inactivated_at.nil? end |
#inactivated_at_or_time ⇒ Object
26 27 28 |
# File 'lib/active_regulation/activation.rb', line 26 def inactivated_at_or_time active? ? Time.now : inactivated_at end |
#inactive! ⇒ Object
14 15 16 |
# File 'lib/active_regulation/activation.rb', line 14 def inactive! update(inactivated_at: Time.now) if active? end |
#inactive? ⇒ Boolean
22 23 24 |
# File 'lib/active_regulation/activation.rb', line 22 def inactive? !active? end |
#to_activation ⇒ Object
30 31 32 |
# File 'lib/active_regulation/activation.rb', line 30 def to_activation I18n.t("active_regulation.activation.#{active? ? :active : :inactive}") end |