Class: Processor

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

Constant Summary collapse

DATA =
{}

Instance Method Summary collapse

Instance Method Details

#bondObject



5
6
7
8
9
10
# File 'lib/processor.rb', line 5

def bond
    self.time_frame
    self.target_calories
    self.diet
    self.exclude
end

#dietObject



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# 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

#excludeObject



60
61
62
63
64
65
66
# 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_caloriesObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# 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_frameObject



12
13
14
15
16
17
18
19
20
21
22
23
24
# 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