Class: QuestionWithLazyFullExplanation

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/interactive/question_with_lazy_full_explanation.rb

Instance Method Summary collapse

Instance Method Details

#ask_and_wait_for_valid_response(&block) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/interactive/question_with_lazy_full_explanation.rb', line 2

def ask_and_wait_for_valid_response(&block)
  loop do
    @reask = false
    puts "#{question} #{options.shortcuts_string}"
    resp = Interactive::Response(options)
    puts options.shortcuts_meanings if resp.invalid?

    yield resp
    break if !resp.invalid? && @reask == false
  end
end

#reask!Object



14
15
16
# File 'lib/interactive/question_with_lazy_full_explanation.rb', line 14

def reask!
  @reask = true
end