lib/rabbit/renderer/display/hook-handler.rb in rabbit-2.2.1 vs lib/rabbit/renderer/display/hook-handler.rb in rabbit-3.0.0
- old
+ new
@@ -9,34 +9,38 @@
def call_hook_procs(procs, *args)
procs.any? {|proc| proc.call(*args)}
end
- def add_motion_notify_hook(hook=Proc.new)
+ def add_motion_notify_hook(hook=nil, &block)
+ hook ||= Proc.new(&block)
@motion_notify_hook_procs << hook
end
def clear_motion_notify_hook
@motion_notify_hook_procs.clear
end
- def add_scroll_hook(hook=Proc.new)
+ def add_scroll_hook(hook=nil, &block)
+ hook ||= Proc.new(&block)
@scroll_hook_procs << hook
end
def clear_scroll_hook
@scroll_hook_procs.clear
end
- def add_button_press_hook(hook=Proc.new)
+ def add_button_press_hook(hook=nil, &block)
+ hook ||= Proc.new(&block)
@button_press_hook_procs << hook
end
def clear_button_press_hook
@button_press_hook_procs.clear
end
- def add_button_release_hook(hook=Proc.new)
+ def add_button_release_hook(hook=nil, &block)
+ hook ||= Proc.new(&block)
@button_release_hook_procs << hook
end
def clear_button_release_hook
@button_release_hook_procs.clear