Sha256: 761b7a3bb32f27bf80b37811a80fc732f5486b6e96b5986d39939755b37cc446
Contents?: true
Size: 1.03 KB
Versions: 3
Compression:
Stored size: 1.03 KB
Contents
require 'acts_as_span/span_instance/validations' require 'acts_as_span/span_instance/status' require 'active_support/core_ext/module/delegation' module ActsAsSpan class SpanInstance include ActsAsSpan::SpanInstance::Validations include ActsAsSpan::SpanInstance::Status delegate :start_field, :end_field, :exclude_end, to: :@acts_as_span_definition delegate :new_record?, to: :span_model attr_reader :name, :span_model, :acts_as_span_definition def initialize(name, span_model, acts_as_span_definition) @name = name @span_model = span_model @acts_as_span_definition = acts_as_span_definition end def span_klass @span_klass ||= span_model.class end def start_date span_model[start_field] end def end_date span_model[end_field] end def start_date_changed? span_model.will_save_change_to_attribute?(start_field) end def end_date_changed? span_model.will_save_change_to_attribute?(end_field) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
acts_as_span-1.2.2 | lib/acts_as_span/span_instance.rb |
acts_as_span-1.2.1 | lib/acts_as_span/span_instance.rb |
acts_as_span-1.2.0 | lib/acts_as_span/span_instance.rb |