Module: Wocket::Bindable
- Included in:
- Server
- Defined in:
- lib/wocket/bindable.rb
Instance Method Summary collapse
Instance Method Details
#available_bindings ⇒ Object
3 4 5 |
# File 'lib/wocket/bindable.rb', line 3 def available_bindings raise NotImplementedError end |
#bind(name, &callback) ⇒ Object
7 8 9 10 |
# File 'lib/wocket/bindable.rb', line 7 def bind(name, &callback) raise "Invalid binding: #{name}" unless available_bindings.include? name @callbacks[name] = callback end |
#trigger(name, *args) ⇒ Object
12 13 14 |
# File 'lib/wocket/bindable.rb', line 12 def trigger(name, *args) @callbacks[name].call *args if @callbacks[name] end |