class IdiomExplorer

Public Class Methods

idiom_routine() click to toggle source
# File lib/words_and_idioms/zz - idiom_explorer_old.rb, line 6
def self.idiom_routine
  IdiomList.new
  counter = 1
  IdiomList.all.each do |hash|
    hash.each do |k,v|
      puts "#{counter}. #{k}"
      counter += 1
    end
  end
  puts " "
  puts "Which idiom would you like me to define?"
  puts " "
  input = (gets.chomp).to_i
  puts " "
  puts "Interesting choice. Here is the definition:".magenta
  puts " "
  hash_value = IdiomList.all[input - 1]
  hash_idiom = hash_value.keys[0]
  hash_def = hash_value[hash_idiom]
  puts "#{hash_idiom.upcase.yellow}: #{hash_def}"
  puts " "
  puts " "
  puts "Would you like to see this word in context?".light_blue
  puts "Y/N"

  context = gets.chomp.downcase
  if context == "y"
    self.usage
    puts " "
    puts " "
    puts @usage_array[input - 1].green
    puts " "
    puts " "
  end
end
new() click to toggle source
# File lib/words_and_idioms/zz - idiom_explorer_old.rb, line 3
def initialize

end
show_idiom() click to toggle source
# File lib/words_and_idioms/idiom_explorer.rb, line 4
def self.show_idiom
  puts "Which idiom would you like me to define?"
  puts " "
  input = ((gets.chomp).to_i - 1)
  idiom = Idiom.all[input]
  puts " "
  puts "Interesting choice. Here is the definition:".magenta
  puts " "
  puts idiom.name.upcase.yellow + ": " + idiom.definition
  puts " "
  puts "Would you like to see this word in context?".light_blue
  puts "Y/N"

  context = gets.chomp.downcase
  if context == "y"
    puts " "
    puts idiom.usage.green
    puts " "
  end
end