Class: Telegram::Controller
- Inherits:
-
Object
- Object
- Telegram::Controller
show all
- Defined in:
- lib/telegram/controller.rb,
lib/telegram/controller/session.rb,
lib/telegram/controller/renderer.rb,
lib/telegram/controller/view_object.rb
Defined Under Namespace
Modules: Session
Classes: Renderer, ViewObject
Instance Method Summary
collapse
Instance Method Details
#bot_name=(name) ⇒ Object
16
17
18
|
# File 'lib/telegram/controller.rb', line 16
def bot_name= name
@bot_name = name
end
|
#bots=(adapters) ⇒ Object
11
12
13
|
# File 'lib/telegram/controller.rb', line 11
def bots= adapters
@bots = adapters
end
|
#dispatch(action) ⇒ Object
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/telegram/controller.rb', line 26
def dispatch action
@current_action = action
self.send action
render unless @has_response
@current_action = nil
end
|
#expose_instance_variables ⇒ Object
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/telegram/controller.rb', line 48
def expose_instance_variables
hash = {}
variables = instance_variables
variables -= not_exposed_instance_variables.map { |v| :"@#{v}" }
variables.each do |name|
var_name = name[1..-1]
hash[var_name] = instance_variable_get(name)
end
hash
end
|
#message=(payload) ⇒ Object
21
22
23
|
# File 'lib/telegram/controller.rb', line 21
def message= payload
@message = payload
end
|
#not_exposed_instance_variables ⇒ Object
38
39
40
41
42
43
44
|
# File 'lib/telegram/controller.rb', line 38
def not_exposed_instance_variables
[
:bots, :message,
:current_action, :rendered,
:bot_name, :has_response,
]
end
|