Class: Oha::Binder

Inherits:
Object
  • Object
show all
Defined in:
lib/oha/binder.rb

Overview

This clas contains the logic to map events to actions

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ Binder

Returns a new instance of Binder.



4
5
6
# File 'lib/oha/binder.rb', line 4

def initialize(context)
  @context = context
end

Instance Method Details

#bind(event) ⇒ Object



8
9
10
11
# File 'lib/oha/binder.rb', line 8

def bind(event)
  @event = event
  self
end

#to(callable_object) ⇒ Object



13
14
15
16
# File 'lib/oha/binder.rb', line 13

def to(callable_object)
  @context.set_callback(@event, callable_object)
  self
end