Sha256: c88b62b78790426382ee8c9ba1e5720fe102f5e3d723964c8b5c75075e00ce76

Contents?: true

Size: 804 Bytes

Versions: 29

Compression:

Stored size: 804 Bytes

Contents

require 'yajl'

class JobDefinition
  attr_accessor :file_queue_name, :reply_exchange_name, :source_tree_path, :sync_exclude, :callbacks

  def initialize(opts={})
    @file_queue_name = opts[:file_queue_name]
    @reply_exchange_name = opts[:reply_exchange_name]
    @source_tree_path = opts[:source_tree_path]
    @callbacks = opts[:callbacks]
    @sync_exclude = opts[:sync_exclude]
  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, :source_tree_path => @source_tree_path, :sync_exclude => @sync_exclude, :callbacks => @callbacks}
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
gorgon-0.4.1 lib/gorgon/job_definition.rb
gorgon-0.4.1.rc1 lib/gorgon/job_definition.rb
gorgon-0.4.0 lib/gorgon/job_definition.rb
gorgon-0.4.0.rc2 lib/gorgon/job_definition.rb
gorgon-0.4.0.rc1 lib/gorgon/job_definition.rb
gorgon-0.3.2 lib/gorgon/job_definition.rb
gorgon-0.3.1 lib/gorgon/job_definition.rb
gorgon-0.3.0 lib/gorgon/job_definition.rb
gorgon-0.2.0 lib/gorgon/job_definition.rb