Class: Telegram::Controller
- Inherits:
-
Object
- Object
- Telegram::Controller
- 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 Attribute Summary collapse
-
#bot_name ⇒ Object
writeonly
Sets the attribute bot_name.
-
#bots ⇒ Object
writeonly
Sets the attribute bots.
-
#message ⇒ Object
writeonly
Sets the attribute message.
-
#params ⇒ Object
writeonly
Sets the attribute params.
Instance Method Summary collapse
- #dispatch(action) ⇒ Object
-
#expose_instance_variables ⇒ Object
TEST.
- #not_exposed_instance_variables ⇒ Object
Instance Attribute Details
#bot_name=(value) ⇒ Object (writeonly)
Sets the attribute bot_name
12 13 14 |
# File 'lib/telegram/controller.rb', line 12 def bot_name=(value) @bot_name = value end |
#bots=(value) ⇒ Object
Sets the attribute bots
11 12 13 |
# File 'lib/telegram/controller.rb', line 11 def bots=(value) @bots = value end |
#message=(value) ⇒ Object (writeonly)
Sets the attribute message
13 14 15 |
# File 'lib/telegram/controller.rb', line 13 def (value) @message = value end |
#params=(value) ⇒ Object
Sets the attribute params
14 15 16 |
# File 'lib/telegram/controller.rb', line 14 def params=(value) @params = value end |
Instance Method Details
#dispatch(action) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/telegram/controller.rb', line 17 def dispatch action @current_action = action self.send action render unless @has_response @current_action = nil # WIP rescue from end |
#expose_instance_variables ⇒ Object
TEST
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/telegram/controller.rb', line 39 def expose_instance_variables hash = {} variables = instance_variables variables -= not_exposed_instance_variables.map { |v| :"@#{v}" } variables.each do |name| # cut @ var_name = name[1..-1] hash[var_name] = instance_variable_get(name) end hash end |
#not_exposed_instance_variables ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/telegram/controller.rb', line 29 def not_exposed_instance_variables [ :bots, :message, :current_action, :rendered, :bot_name, :has_response, ] end |