class Mumukit::Assistant::Message::Progressive

Progressive messages depend on the number of attemps They work with exactly two or three messages:

* the first message will be displayed in the first three attemps
* the second message will be displayed in the fourth, fifth and sixth attemps
* the third message will be displayed starting at the seventh attemp

Public Class Methods

new(alternatives) click to toggle source
# File lib/mumukit/assistant/message.rb, line 22
def initialize(alternatives)
  raise 'You need two or three alternatives' unless alternatives.size.between?(2, 3)
  @alternatives = alternatives
end

Public Instance Methods

call(attemps_count) click to toggle source
# File lib/mumukit/assistant/message.rb, line 27
def call(attemps_count)
  case attemps_count
    when (1..3) then @alternatives.first
    when (4..6) then @alternatives.second
    else @alternatives.last
  end
end