Sha256: 7d52d6dec3d8c4925df739a730b89683374c9a18c40ee3c517f4acb673a8aa9d
Contents?: true
Size: 774 Bytes
Versions: 1
Compression:
Stored size: 774 Bytes
Contents
# Example: # RosettaQueue::Filters.define do |filter_for| # filter_for.receiving { |message| JSON.parse(message) } # filter_for.sending { |hash| hash.to_json } # end module RosettaQueue class Filters class << self def define yield self end def reset @receiving = nil @sending = nil end def receiving(&receiving_filter) @receiving = receiving_filter end def sending(&sending_filter) @sending = sending_filter end def process_sending(message) return message unless @sending @sending.call(message) end def process_receiving(message) return message unless @receiving @receiving.call(message) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bmabey-rosetta_queue-0.3.3 | lib/rosetta_queue/filters.rb |