Class: VkLongpollBot::Events::EventListener
- Inherits:
-
Object
- Object
- VkLongpollBot::Events::EventListener
- Defined in:
- lib/vk_longpoll_bot/events.rb
Overview
Class containing block to run on some event.
Instance Attribute Summary collapse
-
#subtype ⇒ String
readonly
Subtype of this listener.
Instance Method Summary collapse
-
#call(event) ⇒ void
Calls block with given event as argument.
-
#initialize(options) {|event| ... } ⇒ EventListener
constructor
Initialize new listener.
Constructor Details
#initialize(options) {|event| ... } ⇒ EventListener
Initialize new listener
96 97 98 99 |
# File 'lib/vk_longpoll_bot/events.rb', line 96 def initialize(, &block) @subtype = [:subtype] @block = block end |
Instance Attribute Details
#subtype ⇒ String (readonly)
Returns subtype of this listener.
86 87 88 |
# File 'lib/vk_longpoll_bot/events.rb', line 86 def subtype @subtype end |
Instance Method Details
#call(event) ⇒ void
This method returns an undefined value.
Calls block with given event as argument.
107 108 109 |
# File 'lib/vk_longpoll_bot/events.rb', line 107 def call(event) @block.call(event) end |