Sha256: ffe07dd179b7db7a0e3ad2f792a014c5e4a6e74545d6eb9daf0f138dae8d3ec5
Contents?: true
Size: 1.5 KB
Versions: 1
Compression:
Stored size: 1.5 KB
Contents
## # As Certificated 是被认证参与者的领域关注点。 module Unidom module Certificate module Concerns module AsCertificated extend ActiveSupport::Concern include Unidom::Common::Concerns::ArgumentValidation included do |includer| has_many :certificatings, class_name: 'Unidom::Certificate::Certificating', as: :certificated ## # 被认证者被证书 certification 认证,认证者为 by ,认证时间是 at (缺省为当前时间)。 # 如: person.is_certificated! mcse, by: bill_gates, at: Time.now def is_certificated!(certification, by: nil, at: Time.now) assert_present! :certification, certification assert_present! :by, by assert_present! :at, at certificatings.certification_is(certification).valid_at(now: at).alive.first_or_create! certificator: by, opened_at: at end ## # 判断当前被认证者在指定的时间 at (缺省为当前时间)是否有指定的证书 certification 。如: # person.is_certificated? mcse, at: Time.now def is_certificated?(certification, at: Time.now) assert_present! :certification, certification assert_present! :at, at certificatings.certification_is(certification).valid_at(now: at).alive.exists? end end module ClassMethods end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
unidom-certificate-3.0.1 | app/models/unidom/certificate/concerns/as_certificated.rb |