class BunnyMock::Exchange
Attributes
attrs[RW]
name[RW]
queues[RW]
Public Class Methods
new(name, attrs = {})
click to toggle source
# File lib/bunny_mock.rb, line 110 def initialize(name, attrs = {}) self.name = name self.attrs = attrs.dup self.queues = [] end
Public Instance Methods
bound_to?(queue_name)
click to toggle source
# File lib/bunny_mock.rb, line 120 def bound_to?(queue_name) queues.any?{|q| q.name == queue_name} end
method_missing(method, *args)
click to toggle source
Calls superclass method
# File lib/bunny_mock.rb, line 124 def method_missing(method, *args) method_name = method.to_s is_predicate = false if method_name =~ /^(.*)\?$/ key = $1.to_sym is_predicate = true else key = method.to_sym end if attrs.has_key? key value = attrs[key] is_predicate ? !!value : value else super end end
publish(msg, msg_attrs = {})
click to toggle source
# File lib/bunny_mock.rb, line 116 def publish(msg, msg_attrs = {}) queues.each { |q| q.messages << msg } end