Sha256: 6b399fddc1ea40ff96c93ad3dcb52ba161524c9fc155ccb6f107abc82f98f8d4

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

module SimpleWorker


  # Config is used to setup the SimpleWorker client.
  # You must set the access_key and secret_key.
  #
  # config.global_attributes allows you to specify attributes that will automatically be set on every worker,
  #    this is good for database connection information or things that will be used across the board.
  #
  # config.database configures a database connection. If specified like ActiveRecord, SimpleWorker will automatically establish a connection
  # for you before running your worker.
  class Config
    attr_accessor :access_key,
                  :secret_key,
                  :host,
                  :global_attributes,
                  :models,
                  :database,
                  :extra_requires

    def initialize
      @global_attributes = {}
      @extra_requires = []
    end

    def get_atts_to_send
      config_data = {}
      config_data['database'] = database if database
      config_data['global_attributes'] = global_attributes if global_attributes
      config_data['host'] = host if host
      config_data
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simple_worker-0.3.19 lib/simple_worker/config.rb