Sha256: 78f9ddbe34cd0c8a79138a8980913e7a39039d009948fbddaa147f446918a701
Contents?: true
Size: 694 Bytes
Versions: 3
Compression:
Stored size: 694 Bytes
Contents
module ActiveRegulation module Containment extend ActiveSupport::Concern included do scope :contained, -> { where.not(contained_at: nil) } scope :uncontained, -> { where(contained_at: nil) } end def contain! update(contained_at: Time.now) if uncontained? end def uncontain! update(contained_at: nil) if contained? end def contained? !uncontained? end def uncontained? contained_at.nil? end def contained_at_or_time uncontained? ? Time.now : contained_at end def to_containment I18n.t("active_regulation.containment.#{uncontained? ? :uncontained : :contained}") end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
active_regulation-2.4.0 | lib/active_regulation/containment.rb |
active_regulation-2.3.0 | lib/active_regulation/containment.rb |
active_regulation-2.2.6 | lib/active_regulation/containment.rb |