module Helper

This method return value wich match to regular exprassion

Public Instance Methods

to_array(user_input) click to toggle source
# File lib/codebreaker/helper.rb, line 12
def to_array(user_input)
  user_input.split('').map(&:to_i)
end
verify(params) click to toggle source
# File lib/codebreaker/helper.rb, line 3
def verify(params)
  value = gets.strip if params[:value].nil?
  until Regexp.new(params[:matcher]).match(value)
    puts "(!) Please, enter #{params[:message]}"
    value = gets.strip.chomp
  end
  value
end