class RaleighEvents::CLI

CLI controller

Public Instance Methods

call() click to toggle source

Call method will greet the user then list all of the events User will see a menu to learn more info about a particular event

# File lib/raleigh_events/cli.rb, line 6
def call 
  list_events
  menu
  goodbye
end
goodbye() click to toggle source
# File lib/raleigh_events/cli.rb, line 42
def goodbye
  puts "See you tomorrow for more events!!!"
end
list_events() click to toggle source
# File lib/raleigh_events/cli.rb, line 12
def list_events
  #Here doc http://blog.jayfields.com/2006/12/ruby-multiline-strings-here-doc-or.html
  puts "Upcoming events in Raleigh:"
  @events = RaleighEvents::Event.upcoming #theres an object called Event that has a class method #upcoming that returns these events
  
  @events.each.with_index(1) do |event, i|
    puts "#{i}. #{event.title}"
  end
end
menu() click to toggle source

Interactive with the user, showing the list of events