Class: TelegramOnSteroids::Updates
- Inherits:
-
Object
- Object
- TelegramOnSteroids::Updates
- Defined in:
- lib/telegram_on_steroids/updates.rb
Instance Attribute Summary collapse
-
#stop ⇒ Object
writeonly
Sets the attribute stop.
Instance Method Summary collapse
- #enum ⇒ Object
-
#initialize(params) ⇒ Updates
constructor
A new instance of Updates.
Constructor Details
#initialize(params) ⇒ Updates
Returns a new instance of Updates.
4 5 6 |
# File 'lib/telegram_on_steroids/updates.rb', line 4 def initialize(params) @params = params end |
Instance Attribute Details
#stop=(value) ⇒ Object (writeonly)
Sets the attribute stop
2 3 4 |
# File 'lib/telegram_on_steroids/updates.rb', line 2 def stop=(value) @stop = value end |
Instance Method Details
#enum ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/telegram_on_steroids/updates.rb', line 8 def enum Enumerator.new do |y| loop do break if @stop updates = TelegramOnSteroids::Client.new.get_updates(@params)["result"] updates.each do |update| y << update end if updates.any? @params.merge! offset: updates.last["update_id"] + 1 end end end end |