Sha256: a241f8f4e4fce32d66e4080b44954a60e86050de677340bd43183c21927ad359
Contents?: true
Size: 1021 Bytes
Versions: 7
Compression:
Stored size: 1021 Bytes
Contents
module ActsAsSpan class SpanInstance module Status extend ActiveSupport::Concern included do def span_status(query_date = Date.current) if future?(query_date) :future elsif expired?(query_date) :expired elsif current?(query_date) :current else :unknown end end alias_method :span_status_on, :span_status def current?(query_date = Date.current) !future?(query_date) && !expired?(query_date) end alias_method :current_on?, :current? def future?(query_date = Date.current) start_date && start_date > query_date end alias_method :future_on?, :future? def expired?(query_date = Date.current) end_date && end_date < query_date end alias_method :expired_on?, :expired? alias_method :past_on?, :expired? alias_method :past?, :expired? end end end end
Version data entries
7 entries across 7 versions & 1 rubygems