lib/onstomp/interfaces/event_manager.rb in onstomp-1.0.0 vs lib/onstomp/interfaces/event_manager.rb in onstomp-1.0.1
- old
+ new
@@ -5,11 +5,11 @@
# Extends base with {OnStomp::Interfaces::EventManager::ClassMethods}
def self.included(base)
base.extend ClassMethods
end
- # Binds a +Proc+ to be invoked when the given +event_name+ is triggered.
+ # Binds a `Proc` to be invoked when the given `event_name` is triggered.
# @param [Symbol] event_name
# @param [Proc] cb_proc
# @return [self]
def bind_event(event_name, cb_proc)
event_callbacks[event_name] << cb_proc
@@ -21,10 +21,10 @@
def event_callbacks
@event_callbacks ||= Hash.new { |h, k| h[k] = [] }
end
# Triggers an event by the given name, passing along any additional
- # +args+ as parameters to the callback
+ # `args` as parameters to the callback
# @param [Symbol] event_name event to trigger
# @param [Object, Object, ...] args
def trigger_event(event_name, *args)
event_callbacks[event_name].each { |cb| cb.call(*args) }
end