if __FILE__ == $PROGRAM_NAME include Menu include Promptable my_list = List.new puts 'Please choose from the following list' until ['q'].include?(user_input = prompt(show).downcase) end end
THIS LINE: until ['q'].include?(user_input = prompt(show).downcase)
1) is it implied that include? is referring to the user input string? how does this line know you are talking about the user input?
2) so user_input is just a variable we are making or is it a reserved ruby word?
3) with promp(show) i don't understand how this ties together. show isnt even in the prompt method or the promptable module at all. There is a show method in the menu module and the list class... im so lost .
can someone please try to explain this in a very easy way? my head hurts lol
here is my code...
puts "Welcome User"
puts "Todo List Option "
puts "1) Add"
puts "2) Show"
puts "Q) Quit"
def prompt(message = 'What would you like to do?', symbol = ':> ') print message print symbol gets.chomp end
creates an array instance to handle all tasks
@all_tasks = 
all_tasks << task
end def show all_tasks.each do |x| puts x.description end end
# makes an instance readable to a user but not writable
# creates an instance of a task def initialize(description)
@description = description
# this makes a file identifiable if ran from the command line or from another # ruby file _file_ = todo.rb and $PROGRAM_NAME are the same thing where as # todo.rb = file and program name draws internally what the program name is # automatically
if FILE == $PROGRAM_NAME
my_list = List.new
puts " Please choose from the following list"
until ['q'].include?(user_input = prompt(show).downcase)