generatediet 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/Intermediate_diet_gain.rb +14 -0
- data/lib/Intermediate_diet_loss.rb +14 -0
- data/lib/dietplanner.rb +157 -0
- data/lib/generate.rb +22 -0
- data/lib/intensive_diet_gain.rb +14 -0
- data/lib/intensive_diet_loss.rb +14 -0
- data/lib/regular_diet_gain.rb +14 -0
- data/lib/regular_diet_loss.rb +14 -0
- metadata +49 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: afe522d52f795df746b7d03fdd89a69a9afced5a9edfafd4703a4a8705d0129c
|
4
|
+
data.tar.gz: ea2653f121e0b0bc073d6336e7044e4044413f98b7b7c2247143f43b9d4f10aa
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 48fd399a804ea44540fadef05bf0490fdc2c2b3486cf3baa727b66f13a7dac5306783daa7ea1d44a58c6b61ac248b719c87ab16af27d8127ae7a9aa02735eeb0
|
7
|
+
data.tar.gz: c976e824bbecabefec01c711502bdde5d0ca6bd694370a369008da0c843ae899c3616d440b9ea97b2d0ce380d1d6a1cd3ec367e2eb9b67bc5c31cf19c1144d2f
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class IntermediateDietGain
|
2
|
+
|
3
|
+
#generate diet method
|
4
|
+
def generate_diet(context)
|
5
|
+
@hash = Hash.new
|
6
|
+
@hash.store("diet_type","intermediate_diet_gain")
|
7
|
+
@hash.store("time_interval","60days")
|
8
|
+
@hash.store("date_started",context.date_started)
|
9
|
+
@hash.store("initial_weight",context.initial_weight)
|
10
|
+
@hash.store("target_weight",context.target_weight)
|
11
|
+
@hash.store("daily_calories",1500)
|
12
|
+
@hash
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class IntermediateDietLoss
|
2
|
+
|
3
|
+
#generate diet method
|
4
|
+
def generate_diet(context)
|
5
|
+
@hash = Hash.new
|
6
|
+
@hash.store("diet_type","intermediate_diet_loss")
|
7
|
+
@hash.store("time_interval","60days")
|
8
|
+
@hash.store("date_started",context.date_started)
|
9
|
+
@hash.store("initial_weight",context.initial_weight)
|
10
|
+
@hash.store("target_weight",context.target_weight)
|
11
|
+
@hash.store("daily_calories",1200)
|
12
|
+
@hash
|
13
|
+
end
|
14
|
+
end
|
data/lib/dietplanner.rb
ADDED
@@ -0,0 +1,157 @@
|
|
1
|
+
class DietPlanner
|
2
|
+
def initialize(initial_weight, target_weight, date_started, time_interval, daily_calories)
|
3
|
+
@initial_weight = initial_weight
|
4
|
+
@target_weight = target_weight
|
5
|
+
@date_started = date_started
|
6
|
+
end
|
7
|
+
# getter method for current weight
|
8
|
+
def initial_weight
|
9
|
+
@initial_weight
|
10
|
+
end
|
11
|
+
# getter method for target weight
|
12
|
+
def target_weight
|
13
|
+
@target_weight
|
14
|
+
end
|
15
|
+
|
16
|
+
# getter method for date started
|
17
|
+
def date_started
|
18
|
+
@date_started
|
19
|
+
end
|
20
|
+
|
21
|
+
# getter method for time interval
|
22
|
+
def time_interval
|
23
|
+
@time_interval
|
24
|
+
end
|
25
|
+
|
26
|
+
# getter method for daily calories
|
27
|
+
def daily_calories
|
28
|
+
@daily_calories
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# decorator class -- this serves as the superclass for all the concrete decorators
|
33
|
+
|
34
|
+
class DietDecorator
|
35
|
+
def initialize(dietplanner)
|
36
|
+
@dietplanner= dietplanner
|
37
|
+
@intensive_diet_loss = null
|
38
|
+
@intensive_diet_gain = null
|
39
|
+
@intermediate_diet_loss = null
|
40
|
+
@intermediate_diet_gain = null
|
41
|
+
@regular_diet_loss - null
|
42
|
+
@Regular_diet_gain = null
|
43
|
+
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
class Intensive_diet_loss
|
50
|
+
def initialize(diet)
|
51
|
+
@intensive_diet_loss = diet
|
52
|
+
end
|
53
|
+
#generate diet method
|
54
|
+
def generate_diet
|
55
|
+
@hash = Hash.new
|
56
|
+
@hash.store("diet_type","intensive_diet_loss")
|
57
|
+
@hash.store("time_interval","30days")
|
58
|
+
@hash.store("date_started", @intensive_diet_loss.date_started)
|
59
|
+
@hash.store("initial_weight",@intensive_diet_loss.initial_weight)
|
60
|
+
@hash.store("target_weight",@intensive_diet_loss.target_weight)
|
61
|
+
@hash.store("daily_calories",1300)
|
62
|
+
@hash
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
class Intensive_diet_gain
|
67
|
+
def initialize(diet)
|
68
|
+
@intensive_diet_gain = diet
|
69
|
+
end
|
70
|
+
|
71
|
+
#generate diet method
|
72
|
+
def generate_diet
|
73
|
+
@hash = Hash.new
|
74
|
+
@hash.store("diet_type","intensive_diet_gain")
|
75
|
+
@hash.store("time_interval","30days")
|
76
|
+
@hash.store("date_started",@intensive_diet_gain.date_started)
|
77
|
+
@hash.store("initial_weight",@intensive_diet_gain.initial_weight)
|
78
|
+
@hash.store("target_weight",@intensive_diet_gain.target_weight)
|
79
|
+
@hash.store("daily_calories",1800)
|
80
|
+
@hash
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
|
85
|
+
class Intermediate_diet_loss
|
86
|
+
def initialize(diet)
|
87
|
+
@intermediate_diet_loss = diet
|
88
|
+
end
|
89
|
+
|
90
|
+
#generate diet method
|
91
|
+
def generate_diet
|
92
|
+
@hash = Hash.new
|
93
|
+
@hash.store("diet_type","intermediate_diet_loss")
|
94
|
+
@hash.store("time_interval","60days")
|
95
|
+
@hash.store("date_started",@intermediate_diet_loss.date_started)
|
96
|
+
@hash.store("initial_weight",@intermediate_diet_loss.initial_weight)
|
97
|
+
@hash.store("target_weight",@intermediate_diet_loss.target_weight)
|
98
|
+
@hash.store("daily_calories",1200)
|
99
|
+
@hash
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
class Intermediate_diet_gain
|
104
|
+
def initialize(diet)
|
105
|
+
@intermediate_diet_gain = diet
|
106
|
+
end
|
107
|
+
#generate diet method
|
108
|
+
def generate_diet
|
109
|
+
@hash = Hash.new
|
110
|
+
@hash.store("diet_type","intermediate_diet_gain")
|
111
|
+
@hash.store("time_interval","60days")
|
112
|
+
@hash.store("date_started",@intermediate_diet_gain.date_started)
|
113
|
+
@hash.store("initial_weight",@intermediate_diet_gain.initial_weight)
|
114
|
+
@hash.store("target_weight",@intermediate_diet_gain.target_weight)
|
115
|
+
@hash.store("daily_calories",1500)
|
116
|
+
@hash
|
117
|
+
end
|
118
|
+
|
119
|
+
end
|
120
|
+
|
121
|
+
|
122
|
+
class Regular_diet_loss
|
123
|
+
def initialize(diet)
|
124
|
+
@regular_diet_loss= diet
|
125
|
+
end
|
126
|
+
#generate diet method
|
127
|
+
def generate_diet
|
128
|
+
@hash = Hash.new
|
129
|
+
@hash.store("diet_type","regular_diet_loss")
|
130
|
+
@hash.store("time_interval","90days")
|
131
|
+
@hash.store("date_started",@regular_diet_loss.date_started)
|
132
|
+
@hash.store("initial_weight",@regular_diet_loss.initial_weight)
|
133
|
+
@hash.store("target_weight",@regular_diet_loss.target_weight)
|
134
|
+
@hash.store("daily_calories",1300)
|
135
|
+
@hash
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
class Regular_diet_gain
|
140
|
+
|
141
|
+
def initialize(diet)
|
142
|
+
@regular_diet_gain = diet
|
143
|
+
end
|
144
|
+
|
145
|
+
#generate diet method
|
146
|
+
def generate_diet
|
147
|
+
@hash = Hash.new
|
148
|
+
@hash.store("diet_type","regular_diet_gain")
|
149
|
+
@hash.store("time_interval","90days")
|
150
|
+
@hash.store("date_started",@regular_diet_gain.date_started)
|
151
|
+
@hash.store("initial_weight",@regular_diet_gain.initial_weight)
|
152
|
+
@hash.store("target_weight",@regular_diet_gain.target_weight)
|
153
|
+
@hash.store("daily_calories",1800)
|
154
|
+
@hash
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
data/lib/generate.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'intensive_diet_loss'
|
2
|
+
require 'intensive_diet_gain'
|
3
|
+
require 'intermediate_diet_loss'
|
4
|
+
require 'intermediate_diet_gain'
|
5
|
+
require 'regular_diet_loss'
|
6
|
+
require 'regular_diet_gain'
|
7
|
+
|
8
|
+
class GenerateDiet
|
9
|
+
attr_accessor :plan
|
10
|
+
attr_reader :initial_weight, :target_weight, :date_started
|
11
|
+
|
12
|
+
def initialize(plan, initial_weight, target_weight, date_started)
|
13
|
+
@initial_weight = initial_weight
|
14
|
+
@target_weight = target_weight
|
15
|
+
@date_started = date_started
|
16
|
+
@plan = plan
|
17
|
+
end
|
18
|
+
|
19
|
+
def get_plan
|
20
|
+
@plan.generate_diet(self)
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class IntensiveDietGain
|
2
|
+
|
3
|
+
#generate diet method
|
4
|
+
def generate_diet(context)
|
5
|
+
@hash = Hash.new
|
6
|
+
@hash.store("diet_type","intensive_diet_gain")
|
7
|
+
@hash.store("time_interval","30days")
|
8
|
+
@hash.store("date_started",context.date_started)
|
9
|
+
@hash.store("initial_weight",context.initial_weight)
|
10
|
+
@hash.store("target_weight",context.target_weight)
|
11
|
+
@hash.store("daily_calories",1800)
|
12
|
+
@hash
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class IntensiveDietLoss
|
2
|
+
|
3
|
+
#generate diet method
|
4
|
+
def generate_diet(context)
|
5
|
+
@hash = Hash.new
|
6
|
+
@hash.store("diet_type","intensive_diet_loss")
|
7
|
+
@hash.store("time_interval","30days")
|
8
|
+
@hash.store("date_started", context.date_started)
|
9
|
+
@hash.store("initial_weight",context.initial_weight)
|
10
|
+
@hash.store("target_weight",context.target_weight)
|
11
|
+
@hash.store("daily_calories",1300)
|
12
|
+
@hash
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class RegularDietGain
|
2
|
+
|
3
|
+
#generate diet method
|
4
|
+
def generate_diet(context)
|
5
|
+
@hash = Hash.new
|
6
|
+
@hash.store("diet_type","regular_diet_gain")
|
7
|
+
@hash.store("time_interval","90days")
|
8
|
+
@hash.store("date_started",context.date_started)
|
9
|
+
@hash.store("initial_weight",context.initial_weight)
|
10
|
+
@hash.store("target_weight",context.target_weight)
|
11
|
+
@hash.store("daily_calories",1800)
|
12
|
+
@hash
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class RegularDietLoss
|
2
|
+
|
3
|
+
#generate diet method
|
4
|
+
def generate_diet(context)
|
5
|
+
@hash = Hash.new
|
6
|
+
@hash.store("diet_type","regular_diet_loss")
|
7
|
+
@hash.store("time_interval","90days")
|
8
|
+
@hash.store("date_started",context.date_started)
|
9
|
+
@hash.store("initial_weight",context.initial_weight)
|
10
|
+
@hash.store("target_weight",context.target_weight)
|
11
|
+
@hash.store("daily_calories",1300)
|
12
|
+
@hash
|
13
|
+
end
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: generatediet
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Bimbo Ogungbe
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-11-28 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: returns true if the diet generated, otherwise returns false.
|
14
|
+
email: bimbo.ogungbe4@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/Intermediate_diet_gain.rb
|
20
|
+
- lib/Intermediate_diet_loss.rb
|
21
|
+
- lib/dietplanner.rb
|
22
|
+
- lib/generate.rb
|
23
|
+
- lib/intensive_diet_gain.rb
|
24
|
+
- lib/intensive_diet_loss.rb
|
25
|
+
- lib/regular_diet_gain.rb
|
26
|
+
- lib/regular_diet_loss.rb
|
27
|
+
homepage: http://rubygems.org/gems/FitnessApp
|
28
|
+
licenses: []
|
29
|
+
metadata: {}
|
30
|
+
post_install_message:
|
31
|
+
rdoc_options: []
|
32
|
+
require_paths:
|
33
|
+
- lib
|
34
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ">="
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
requirements: []
|
45
|
+
rubygems_version: 3.0.3
|
46
|
+
signing_key:
|
47
|
+
specification_version: 4
|
48
|
+
summary: generate diet plan based on user.
|
49
|
+
test_files: []
|