Class: Lita::Standups::Models::StandupResponse
- Includes:
- Ohm::Callbacks, Ohm::DataTypes, Ohm::Timestamps
- Defined in:
- lib/lita/standups/models/standup_response.rb
Instance Method Summary collapse
- #after_save ⇒ Object
- #before_create ⇒ Object
- #finished? ⇒ Boolean
- #questions ⇒ Object
- #report_message ⇒ Object
- #standup ⇒ Object
- #user ⇒ Object
Methods inherited from Base
Instance Method Details
#after_save ⇒ Object
37 38 39 |
# File 'lib/lita/standups/models/standup_response.rb', line 37 def after_save standup_session.update_status if finished? end |
#before_create ⇒ Object
33 34 35 |
# File 'lib/lita/standups/models/standup_response.rb', line 33 def before_create self.status ||= 'pending' end |
#finished? ⇒ Boolean
50 51 52 |
# File 'lib/lita/standups/models/standup_response.rb', line 50 def finished? completed? || aborted? || expired? end |
#questions ⇒ Object
29 30 31 |
# File 'lib/lita/standups/models/standup_response.rb', line 29 def questions standup.questions end |
#report_message ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/lita/standups/models/standup_response.rb', line 54 def = "#{user.name} (a.k.a @#{user.mention_name})\n" if answers.is_a?(Array) questions.map.with_index do |question, index| if answers[index] << "> *#{question}*\n" answers[index].split("\n").each do |line| << "> #{line}\n" end end << "> \n" if index < questions.count - 1 end else << "> *Expired*\n" end end |
#standup ⇒ Object
25 26 27 |
# File 'lib/lita/standups/models/standup_response.rb', line 25 def standup standup_session.standup end |
#user ⇒ Object
21 22 23 |
# File 'lib/lita/standups/models/standup_response.rb', line 21 def user @user ||= Lita::User.fuzzy_find(user_id) end |