Sha256: 7c07222c1296ccaca0be2205a6c1fce472248dd2153d998688c1cf3a49e39999

Contents?: true

Size: 374 Bytes

Versions: 1

Compression:

Stored size: 374 Bytes

Contents

# This method return value wich match to regular exprassion
module Helper
  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

  def to_array(user_input)
    user_input.split('').map(&:to_i)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
edg_codebreaker-0.1.0 lib/codebreaker/helper.rb