Module: Untied::Publisher
- Defined in:
- lib/untied-publisher.rb,
lib/untied-publisher/amqp.rb,
lib/untied-publisher/base.rb,
lib/untied-publisher/bunny.rb,
lib/untied-publisher/config.rb,
lib/untied-publisher/railtie.rb,
lib/untied-publisher/version.rb,
lib/untied-publisher/observer.rb,
lib/untied-publisher/doorkeeper.rb,
lib/untied-publisher/amqp/producer.rb,
lib/untied-publisher/base_producer.rb,
lib/untied-publisher/bunny/producer.rb,
lib/untied-publisher/event_representer.rb,
lib/untied-publisher/default_doorkeeper.rb
Defined Under Namespace
Modules: AMQP, Base, Bunny, Doorkeeper, EventRepresenter Classes: BaseProducer, Config, DefaultDoorkeeper, Observer, Railtie
Constant Summary collapse
- VERSION =
"0.0.6"
Class Method Summary collapse
- .adapter ⇒ Object
- .config ⇒ Object
-
.configure {|config| ... } ⇒ Object
Configures untied-publisher.
-
.constantize(class_name) ⇒ Object
Transforms string into constant.
Class Method Details
.adapter ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/untied-publisher.rb', line 34 def self.adapter producer_booter = "Untied::Publisher::#{self.config.adapter}" @adapter ||= begin begin constantize(producer_booter) rescue NameError config.logger.info "#{producer_booter} is not defined. Falling back " +\ "to Untied::Publisher::Bunny" Untied::Publisher::Bunny end end end |
.config ⇒ Object
30 31 32 |
# File 'lib/untied-publisher.rb', line 30 def self.config @config ||= Config.new end |
.configure {|config| ... } ⇒ Object
Configures untied-publisher.
20 21 22 23 24 25 26 27 28 |
# File 'lib/untied-publisher.rb', line 20 def self.configure(&block) yield(config) if block_given? if config. adapter.start else config.adapter = :Base adapter.start end end |
.constantize(class_name) ⇒ Object
Transforms string into constant
49 50 51 52 53 54 55 |
# File 'lib/untied-publisher.rb', line 49 def self.constantize(class_name) unless /\A(?:::)?([A-Z]\w*(?:::[A-Z]\w*)*)\z/ =~ class_name raise NameError, "#{class_name.inspect} is not a valid constant name!" end Object.module_eval("::#{$1}", __FILE__, __LINE__) end |