class Processor

Constants

DATA

Public Instance Methods

bond() click to toggle source
# File lib/processor.rb, line 5
def bond
    self.time_frame
    self.target_calories
    self.diet
    self.exclude
end
diet() click to toggle source
# File lib/processor.rb, line 43
def diet
    puts "                         ♦♦ Do you have a diet preference? ♦♦                         "
    puts "♦♦ 1. none  2. vegeterian  3. pescaterian  4. vegan  [type in if other than listed] ♦♦"
    diet = gets.chomp 
    if diet == '1'
        DATA[:diet] = 'none'
    elsif diet == '2'
        DATA[:diet] = 'vegeterian'
    elsif diet == '3'
        DATA[:diet] = 'pescaterian'
    elsif diet == '4'
        DATA[:diet] = 'vegan'
    else
        DATA[:diet] = diet.split(' ').join('')
    end
end
exclude() click to toggle source
# File lib/processor.rb, line 60
def exclude
    puts "♦♦ Are you allergic to anything or there is a certain items you would like us to exclude? ♦♦"
    puts "                      ♦♦ Please list those items or type in 'none' ♦♦                     "
    exclude_input = gets.chomp
    exclude_input = exclude_input.split(' ')
    DATA[:exclude] = exclude_input
end
target_calories() click to toggle source
# File lib/processor.rb, line 26
def target_calories
    if DATA[:time_frame] == 'day'
        puts "♦♦ What is your daily target calories, please type in [500-3000] ♦♦"
        target_calories = gets.chomp
        self.target_calories if target_calories.to_i > 3000 || target_calories.to_i < 500
        DATA[:target_calories] = target_calories.to_i
    end

    if DATA[:time_frame] == 'week'
        puts "♦♦ What is your weekly target calories, please type in [3000-21000] ♦♦"
        target_calories = gets.chomp
        self.target_calories if target_calories.to_i > 21000 || target_calories.to_i < 3000
        DATA[:target_calories] = target_calories.to_i
    end

end
time_frame() click to toggle source
# File lib/processor.rb, line 12
def time_frame
    puts "           ♦♦ What is a time frame for your diet? ♦♦          "
    puts "                 ♦♦ 1. Day       2. Week ♦♦       [1/2]       "
    time_frame = gets.chomp
    if time_frame == '1'
        DATA[:time_frame] = 'day'
    elsif time_frame == '2'
        DATA[:time_frame] = 'week'
    else
        puts "♦♦ Please enter 1 to choose a 'day' or 2 for a 'week' ♦♦"
        self.time_frame
    end
end