Sha256: 0e1087693a8f62d0e02760208ede0616e86ee0e611b264cfda612c598a5503e2
Contents?: true
Size: 857 Bytes
Versions: 2
Compression:
Stored size: 857 Bytes
Contents
# frozen_string_literal: true module Lite module Regulation module Suspension extend ActiveSupport::Concern included do scope :suspended, -> { where.not(suspended_at: nil) } scope :unsuspended, -> { where(suspended_at: nil) } end def suspend! return true if suspended? update(suspended_at: Time.current) end def suspended? !unsuspended? end def suspended_at_or_time return suspended_at if unsuspended? Lite::Regulation::Base.timestamp end def to_suspension I18n.t("lite.regulation.suspension.#{:un if unsuspended?}suspended") end def unsuspend! return true if unsuspended? update(suspended_at: nil) end def unsuspended? suspended_at.nil? end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
lite-regulation-1.0.1 | lib/lite/regulation/suspension.rb |
lite-regulation-1.0.0 | lib/lite/regulation/suspension.rb |