class FuzzySearcher

Public Class Methods

new() click to toggle source
# File lib/fuzzy_searcher.rb, line 2
def initialize
  @exiter = Exiter.new
end

Public Instance Methods

get_verified_user_input(selection_options_size) click to toggle source
# File lib/fuzzy_searcher.rb, line 67
def get_verified_user_input(selection_options_size)
  index = $stdin.gets.chomp.to_i - 1
  if index < 0 || index >= selection_options_size
    @exiter.exit_due_to_incorrect_index
    return
  end

  return index
end
show_selection_options(links_hash) click to toggle source
# File lib/fuzzy_searcher.rb, line 60
def show_selection_options(links_hash)
  puts "Enter the index of the docs you want. ex: Enter 1 if you wish to select the first option.".green
  links_hash.keys.each_with_index do |class_name, i|
    puts "#{i+1}: #{class_name}"
  end
end