Sha256: fcb75173fff154c01d6cf148f7288197bb816899ccd94d7218836ddcf7f7959f

Contents?: true

Size: 593 Bytes

Versions: 10

Compression:

Stored size: 593 Bytes

Contents

module XporterOnDemand
  module Result
    class Base
      include XporterOnDemand::Utils

      def initialize(args = {})
        result = args.delete(:result)
        assign_attributes(result)
      end

      def type
        self.class.name.demodulize
      end

      def update(other_result)
        return if other_result.type != type ||\
                  other_result.id != id ||\
                  other_result.last_updated <= last_updated

        attributes.each do |attribute|
          send("#{attribute}=", other_result.send(attribute))
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
xporter_on_demand-0.2.4 lib/xporter_on_demand/result/base.rb
xporter_on_demand-0.2.3 lib/xporter_on_demand/result/base.rb
xporter_on_demand-0.2.2 lib/xporter_on_demand/result/base.rb
xporter_on_demand-0.2.1 lib/xporter_on_demand/result/base.rb
xporter_on_demand-0.2.0 lib/xporter_on_demand/result/base.rb
xporter_on_demand-0.1.4 lib/xporter_on_demand/result/base.rb
xporter_on_demand-0.1.3 lib/xporter_on_demand/result/base.rb
xporter_on_demand-0.1.2 lib/xporter_on_demand/result/base.rb
xporter_on_demand-0.1.1 lib/xporter_on_demand/result/base.rb
xporter_on_demand-0.1.0 lib/xporter_on_demand/result/base.rb