Sha256: 166b8958fccb07792b9d6f6dcff90da4e0a1c1a22537b3f4bc389c3d347cfdef
Contents?: true
Size: 1.5 KB
Versions: 1
Compression:
Stored size: 1.5 KB
Contents
require "queuel/version" require "forwardable" require "queuel/null/message" require "queuel/null/engine" require "queuel/null/poller" require "queuel/null/queue" require "queuel/iron_mq/message" require "queuel/iron_mq/engine" require "queuel/iron_mq/poller" require "queuel/iron_mq/queue" require "queuel/client" module Queuel class << self extend Forwardable def_delegators :client, :push, :pop, :receive, :with def_delegators :config, :credentials, :default_queue alias << pop end def self.engine requires Object.module_eval("::#{const_name}", __FILE__, __LINE__) end def self.configure(&block) config.instance_eval &block end def self.config @config ||= Configurator.new end def self.client Client.new engine, credentials end def self.engines { iron_mq: { require: 'iron_mq', const: "IronMq" }, null: { const: "Null" } } end def self.requires require engines[config.engine][:require] if engines.fetch(config.engine, {})[:require] end def self.const_name "Queuel::#{engines.fetch(config.engine, {}).fetch(:const, nil) || engines[:null][:const]}::Engine" end class Configurator def self.param(*params) params.each do |name| attr_accessor name define_method name do |*values| value = values.first value ? self.send("#{name}=", value) : instance_variable_get("@#{name}") end end end param :credentials param :engine param :default_queue end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
queuel-0.0.1 | lib/queuel.rb |