Class: Tramway::Bots::Telegram::User
- Inherits:
-
ApplicationRecord
- Object
- Core::ApplicationRecord
- ApplicationRecord
- Tramway::Bots::Telegram::User
- Defined in:
- app/models/tramway/bots/telegram/user.rb
Instance Method Summary collapse
- #current_state(bot) ⇒ Object
-
#finished_state_for?(bot:) ⇒ Boolean
rubocop:enable Naming/AccessorMethodName.
-
#set_finished_state_for(bot:) ⇒ Object
rubocop:disable Naming/AccessorMethodName.
Instance Method Details
#current_state(bot) ⇒ Object
24 25 26 |
# File 'app/models/tramway/bots/telegram/user.rb', line 24 def current_state(bot) states.where(bot_id: bot.id).last&.current_state end |
#finished_state_for?(bot:) ⇒ Boolean
rubocop:enable Naming/AccessorMethodName
34 35 36 |
# File 'app/models/tramway/bots/telegram/user.rb', line 34 def finished_state_for?(bot:) states.empty? || states.where(bot_id: bot.id).last&.current_state == 'finished' end |
#set_finished_state_for(bot:) ⇒ Object
rubocop:disable Naming/AccessorMethodName
29 30 31 |
# File 'app/models/tramway/bots/telegram/user.rb', line 29 def set_finished_state_for(bot:) states.create! bot_id: bot.id, current_state: :finished end |