module BunnyPublisher

Constants

VERSION

Public Class Methods

configure() { |config| ... } click to toggle source
# File lib/bunny_publisher.rb, line 24
def configure
  require 'ostruct'

  config = OpenStruct.new(mandatory: false, test: false)

  yield(config)

  klass = Class.new(Base) do
    include ::BunnyPublisher::Mandatory if config.delete_field(:mandatory)
    include ::BunnyPublisher::Test      if config.delete_field(:test)
  end

  @publisher = klass.new(**config.to_h)
end
method_missing(method_name, *args) click to toggle source
Calls superclass method
# File lib/bunny_publisher.rb, line 39
def method_missing(method_name, *args)
  if publisher.respond_to?(method_name)
    publisher.send(method_name, *args)
  else
    super
  end
end
publish(message, options = {}) click to toggle source
# File lib/bunny_publisher.rb, line 16
def publish(message, options = {})
  publisher.publish(message, options)
end
publisher() click to toggle source
# File lib/bunny_publisher.rb, line 20
def publisher
  @publisher ||= Base.new
end
respond_to_missing?(method_name, *args) click to toggle source
Calls superclass method
# File lib/bunny_publisher.rb, line 47
def respond_to_missing?(method_name, *args)
  publisher.respond_to?(method_name) || super
end