lib/submodules/ably-ruby/lib/ably/modules/event_emitter.rb in ably-rest-1.0.5 vs lib/submodules/ably-ruby/lib/ably/modules/event_emitter.rb in ably-rest-1.0.6
- old
+ new
@@ -29,11 +29,11 @@
#
# @param [Hash] options the options for the {EventEmitter}
# @option options [Proc] :coerce_into A lambda/Proc that is used to coerce the event names for all events. This is useful to ensure the event names conform to a naming or type convention.
#
# @example
- # configure_event_emitter coerce_into: Proc.new { |event| event.to_sym }
+ # configure_event_emitter coerce_into: lambda { |event| event.to_sym }
#
def configure_event_emitter(options = {})
@event_emitter_coerce_proc = options[:coerce_into]
end
@@ -156,10 +156,10 @@
# Create a Hash with a proc that calls the provided block and returns true if option :delete_once_run is set to true.
# #emit automatically deletes any blocks that return true thus allowing a block to be run once
def proc_for_block(block, options = {})
{
- emit_proc: Proc.new do |*args|
+ emit_proc: lambda do |*args|
block.call(*args)
true if options[:delete_once_run]
end,
block: block,
unsafe: options[:unsafe] || false