class NerdFlirt::Main

Attributes

user[RW]

Public Instance Methods

find_match() click to toggle source
# File lib/nerd_flirt/main.rb, line 61
def find_match
  printer.line
  puts "\n"
  print "\n"

  server = TCPSocket.open('127.0.0.1', 8000) # ENV['SERVER_IP'], ENV['SERVER_PORT']
  NerdFlirt::Client.new(server, user.name)

  puts "\n"
  printer.line

  view_menu

  puts "\n"
  printer.line

  puts "\n\n\n\n"
end
input?() click to toggle source
# File lib/nerd_flirt/main.rb, line 88
def input?
  print '> '.colorize :yellow
  input = $stdin.gets.chomp()

  input?
end
new_user?() click to toggle source
# File lib/nerd_flirt/main.rb, line 25
def new_user?
  # check json file for user
  true
end
new_user_prompt() click to toggle source
# File lib/nerd_flirt/main.rb, line 30
def new_user_prompt
  printer.four_breaks
  printer.text "You will need to enter 4 lines of information for your nerd flirt: your gender, age, name and a opening question.", nil, true
  puts "\n"
  sleep 3
  printer.line
  printer.four_breaks

  puts "Gender (m/f):"
  print '> '
  gender = $stdin.gets.chomp

  puts "Name:"
  print '> '
  name = $stdin.gets.chomp

  puts "Age:"
  print '> '
  age = $stdin.gets.chomp

  puts "Now enter the first question you would like to ask your flirt."
  print '> '
  question = $stdin.gets.chomp

  self.user = NerdFlirt::User.new name: name, gender: gender, age: age

  printer.text "Smooth. Ok let's see what we got here, #{user.name}", :magenta
  printer.loading_dots
  puts "\n"
end
printer() click to toggle source
# File lib/nerd_flirt/main.rb, line 95
def printer
  @printer ||= NerdFlirt::Printer
end
start() click to toggle source
# File lib/nerd_flirt/main.rb, line 7
def start
  welcome
  view_menu

  if new_user?
    new_user_prompt
  end

  find_match
  input?
end
view_menu() click to toggle source
# File lib/nerd_flirt/main.rb, line 80
def view_menu
  puts "\n"
  puts 'Menu:'.colorize :magenta
  printer.text '/new = find new flirt'
  print "\n"
  printer.text '/exit = quit application'
end
welcome() click to toggle source
# File lib/nerd_flirt/main.rb, line 19
def welcome
  system "clear" unless system "cls"
  printer.banner
  sleep 2
end