Class: RosettaQueue::Filters

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

Class Method Summary collapse

Class Method Details

.define {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



13
14
15
# File 'lib/rosetta_queue/filters.rb', line 13

def define
  yield self
end

.process_receiving(message) ⇒ Object



35
36
37
38
# File 'lib/rosetta_queue/filters.rb', line 35

def process_receiving(message)
  return message unless @receiving
  @receiving.call(message)
end

.process_sending(message) ⇒ Object



30
31
32
33
# File 'lib/rosetta_queue/filters.rb', line 30

def process_sending(message)
  return message unless @sending
  @sending.call(message)
end

.receiving(&receiving_filter) ⇒ Object



22
23
24
# File 'lib/rosetta_queue/filters.rb', line 22

def receiving(&receiving_filter)
  @receiving = receiving_filter
end

.resetObject



17
18
19
20
# File 'lib/rosetta_queue/filters.rb', line 17

def reset
  @receiving = nil
  @sending = nil
end

.safe_process_receiving(message) ⇒ Object



44
45
46
# File 'lib/rosetta_queue/filters.rb', line 44

def safe_process_receiving(message)
  safe(:process_receiving, message)
end

.safe_process_sending(message) ⇒ Object



40
41
42
# File 'lib/rosetta_queue/filters.rb', line 40

def safe_process_sending(message)
  safe(:process_sending, message)
end

.sending(&sending_filter) ⇒ Object



26
27
28
# File 'lib/rosetta_queue/filters.rb', line 26

def sending(&sending_filter)
  @sending = sending_filter
end