Class: OrlandoTechMeetups::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/orlando_tech_meetups/cli.rb

Instance Method Summary collapse

Instance Method Details

#callObject



2
3
4
5
# File 'lib/orlando_tech_meetups/cli.rb', line 2

def call
  list_meetups
  menu
end

#list_meetupsObject



26
27
28
29
30
31
# File 'lib/orlando_tech_meetups/cli.rb', line 26

def list_meetups
  puts "Hello and Welcome to the Orlando Tech Scene!"
  puts "Loading meetups"
  meetup
  puts "Enter the number of the meetup group you're interested in going to:" 
end

#meetupObject



33
34
35
36
37
38
# File 'lib/orlando_tech_meetups/cli.rb', line 33

def meetup
  @meetups = OrlandoTechMeetups::Meetups.all
  @meetups.each.with_index(1) do |meetup, i|
    puts "#{i}. #{meetup.name}"
  end
end


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/orlando_tech_meetups/cli.rb', line 7

def menu
  input = nil
  while input != "exit" 
    input = gets.strip.downcase
    if input.to_i > 0
      the_group = @meetups[input.to_i-1]
      puts "#{the_group.name}"
      puts "The next meetup is: #{the_group.next_meetup}"
      puts "#{the_group.url}"
      puts "Copy and paste the link above into your browser to check it out and learn more!"
      puts "To go back to the menu, enter 'menu'. To exit, type 'exit'."
    elsif input == "menu"
      meetup
    else
      puts "Hope to see you soon!"
    end
  end
end