class Input

Constants

VALID_OPTIONS

Public Instance Methods

action_verified?(input) click to toggle source
# File lib/easy_portfolio/input.rb, line 12
def action_verified?(input)
  input.downcase == 'y' ? true : false
end
answer_is_yes?(answer) click to toggle source
# File lib/easy_portfolio/input.rb, line 16
def answer_is_yes?(answer)
  answer == 'y' ? true : false
end
ask_yes_or_no() click to toggle source
# File lib/easy_portfolio/input.rb, line 4
def ask_yes_or_no
  loop do 
    answer = command_line_input.downcase
    return answer if VALID_OPTIONS.include?(answer)
    puts 'Please input either y (yes) or n (no).'
  end
end

Private Instance Methods

command_line_input() click to toggle source
# File lib/easy_portfolio/input.rb, line 26
def command_line_input
  $stdin.gets.chomp
end