Class: Smith::Messaging::Sender

Inherits:
Object
  • Object
show all
Defined in:
lib/fake_smith.rb

Instance Method Summary collapse

Constructor Details

#initialize(queue_name, &blk) ⇒ Sender

Returns a new instance of Sender.



92
93
94
95
# File 'lib/fake_smith.rb', line 92

def initialize(queue_name, &blk)
  @queue_name = queue_name
  blk.call(self) if block_given?
end

Instance Method Details

#message_count(&blk) ⇒ Object



102
103
104
# File 'lib/fake_smith.rb', line 102

def message_count(&blk)
  blk.call FakeSmith.get_messages(@queue_name).count if block_given?
end

#publish(message, &blk) ⇒ Object



97
98
99
100
# File 'lib/fake_smith.rb', line 97

def publish(message, &blk)
  FakeSmith.add_message(@queue_name, message)
  blk.call if block_given?
end