Sha256: d9eacf48a32c0a4a4fb68bd3373489d2efdbcbd33a34b0dc66365c2bf900d0b0

Contents?: true

Size: 693 Bytes

Versions: 13

Compression:

Stored size: 693 Bytes

Contents

require 'yajl'

class JobDefinition
  attr_accessor :file_queue_name, :reply_exchange_name, :sync, :callbacks

  def initialize(opts={})
    @file_queue_name = opts[:file_queue_name]
    @reply_exchange_name = opts[:reply_exchange_name]
    @callbacks = opts[:callbacks]
    @sync = opts[:sync]
  end

  def to_json
    Yajl::Encoder.encode(to_hash)
  end

  private

  #This can probably be done with introspection somehow, but this is way easier despite being very verbose
  def to_hash
    {
      :type => "job_definition",
      :file_queue_name => @file_queue_name,
      :reply_exchange_name => @reply_exchange_name,
      :sync => @sync,
      :callbacks => @callbacks
    }
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
gorgon-0.11.0 lib/gorgon/job_definition.rb
gorgon-0.10.5 lib/gorgon/job_definition.rb
gorgon-0.10.4 lib/gorgon/job_definition.rb
gorgon-0.10.3 lib/gorgon/job_definition.rb
gorgon-0.10.2 lib/gorgon/job_definition.rb
gorgon-0.10.1 lib/gorgon/job_definition.rb
gorgon-0.10.0 lib/gorgon/job_definition.rb
gorgon-0.9.0 lib/gorgon/job_definition.rb
gorgon-0.8.4 lib/gorgon/job_definition.rb
gorgon-0.8.3 lib/gorgon/job_definition.rb
gorgon-0.8.2 lib/gorgon/job_definition.rb
gorgon-0.8.1 lib/gorgon/job_definition.rb
gorgon-0.8.0 lib/gorgon/job_definition.rb