Module: Ankit::Challenge::Approaching

Included in:
RefillState, Ankit::ChallengeCommand
Defined in:
lib/ankit/challenge.rb

Instance Method Summary collapse

Instance Method Details

#initial_stateObject

Raises:



466
467
468
469
470
471
472
# File 'lib/ankit/challenge.rb', line 466

def initial_state
  # XXX: Care the case where |card| < limit
  limit = [self.session.limit, Slot::BATCH_SIZE].min
  slots = Coming.coming_paths(self.runtime).take(limit).map { |path| Slot.new(path, nil) }
  raise ExpectedFatalError, "You have no card yet" if slots.empty?
  QuestionState.new(Progress.new(self.session, slots))
end