Module: Wisper
- Defined in:
- lib/wisper.rb,
lib/wisper/version.rb,
lib/wisper/registration/block.rb,
lib/wisper/registration/object.rb,
lib/wisper/registration/registration.rb
Defined Under Namespace
Classes: BlockRegistration, ObjectRegistration, Registration
Constant Summary
collapse
- VERSION =
"1.0.0"
Instance Method Summary
collapse
Instance Method Details
#add_block_listener(options = {}, &block) ⇒ Object
18
19
20
21
|
# File 'lib/wisper.rb', line 18
def add_block_listener(options = {}, &block)
listeners << BlockRegistration.new(block, options)
self
end
|
#add_listener(listener, options = {}) ⇒ Object
Also known as:
subscribe
11
12
13
14
|
# File 'lib/wisper.rb', line 11
def add_listener(listener, options = {})
listeners << ObjectRegistration.new(listener, options)
self
end
|
#listeners ⇒ Object
7
8
9
|
# File 'lib/wisper.rb', line 7
def listeners
@listeners ||= Set.new
end
|
#respond_to(event, &block) ⇒ Object
Also known as:
on
24
25
26
|
# File 'lib/wisper.rb', line 24
def respond_to(event, &block)
add_block_listener({:on => event}, &block)
end
|