Sha256: a108c6d5a531795c6ad9a2dacc29e0f2bf68d20474eb681e1a36a4183d4e026e
Contents?: true
Size: 1.15 KB
Versions: 6
Compression:
Stored size: 1.15 KB
Contents
module Unidom::Action::Concerns::AsObsolesced extend ActiveSupport::Concern include Unidom::Common::Concerns::ArgumentValidation included do |includer| has_many :obsolescings, class_name: 'Unidom::Action::Obsolescing', as: :obsolesced def is_obsolesced!(obsolescence_code: 'OBSL', due_to: nil, via: nil, by: nil, at: Time.now) assert_present! :obsolescence_code, obsolescence_code assert_present! :via, via obsolescings.create! obsolescence_code: 'OBSL', obsolescer_visitor: via, obsolescer_party: by, reason: due_to, opened_at: at end def is_obsolesced?(obsolescence_code: 'OBSL', due_to: nil, via: nil, by: nil, at: Time.now) query = obsolescings query = query.obsolescence_coded_as obsolescence_code if obsolescence_code.present? query = query.obsolesced_by by if by.present? query = query.obsolesced_via via if via.present? query = query.caused_by due_to if due_to.present? query = query.valid_at now: at if at.present? query.exists? end end module ClassMethods end end
Version data entries
6 entries across 6 versions & 1 rubygems