Sha256: c97a788b8d8ba2af952cc72be01dd500d2754696070e0df9ed4913812030d989

Contents?: true

Size: 690 Bytes

Versions: 1

Compression:

Stored size: 690 Bytes

Contents

module Travis
  module Notifications
    class Worker
      class Payload
        attr_reader :job, :extra

        def initialize(job, extra = {})
          @job, @extra = job, extra
        end

        def to_hash
          render(:hash)
        end

        def render(format)
          Travis::Renderer.send(format, data, :type => 'worker', :template => template, :base_dir => base_dir).deep_merge(extra)
        end

        def data
          { :job => job, :repository => job.repository }
        end

        def template
          job.class.name.underscore
        end

        def base_dir
          File.expand_path('../views', __FILE__)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
travis-core-0.0.1 lib/travis/notifications/worker/payload.rb