Sha256: 59be077f996e12fb036cf145c9e2f26760f5dd1b2306e0bc1a0eae4da23dfa19

Contents?: true

Size: 545 Bytes

Versions: 1

Compression:

Stored size: 545 Bytes

Contents

class Build
  module Denormalize
    def denormalize(event, *args)
      repository.update_attributes!(denormalize_attributes_for(event)) if denormalize?(event)
    end

    DENORMALIZE = {
      :start  => %w(id number status started_at finished_at),
      :finish => %w(status finished_at)
    }

    def denormalize?(event)
      DENORMALIZE.key?(event)
    end

    def denormalize_attributes_for(event)
      DENORMALIZE[event].inject({}) do |result, key|
        result.merge(:"last_build_#{key}" => send(key))
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
travis-core-0.0.1 lib/travis/model/build/denormalize.rb