foodAIHE 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.travis.yml +5 -0
- data/Gemfile +6 -0
- data/Guardfile +82 -0
- data/LICENSE.txt +21 -0
- data/README.md +70 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/docs/DLLModule/DLL.html +1185 -0
- data/docs/DLLModule/Node.html +409 -0
- data/docs/DLLModule.html +126 -0
- data/docs/Food.html +567 -0
- data/docs/FoodAbstract.html +807 -0
- data/docs/FoodGem.html +156 -0
- data/docs/_config.yml +1 -0
- data/docs/_index.html +154 -0
- data/docs/class_list.html +51 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +492 -0
- data/docs/file.README.html +161 -0
- data/docs/file_list.html +56 -0
- data/docs/frames.html +17 -0
- data/docs/index.html +161 -0
- data/docs/input/food-data.txt +19 -0
- data/docs/input/samples-data.txt +9 -0
- data/docs/js/app.js +248 -0
- data/docs/js/full_list.js +216 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +267 -0
- data/docs/top-level-namespace.html +297 -0
- data/food.gemspec +41 -0
- data/lib/food/dll.rb +168 -0
- data/lib/food/food_class.rb +132 -0
- data/lib/food/version.rb +6 -0
- data/lib/food.rb +91 -0
- metadata +165 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d618ef5b5151f6035dd39024d5be730ccdd6279b
|
4
|
+
data.tar.gz: 493c34717e968d18db0df67b74480f1dcbae66b2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 74d7923907fb37ea63f82fda82a36ebcf761aa2ba9d6ca77aedfdd7e3f7c5bac105d83610b84174d02b2b2760c329e2a3fbe3d31e511ade1e56beebdac871485
|
7
|
+
data.tar.gz: af3a7c7532b0c5fbf265ef0dc74c33af69dda8a8dfd7dbfc5e38332da85a0cb7c297c0cbfe9cd8428eb29e14d6dae49e4c49ab014929247033bcc4a0155debe8
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
## Uncomment and set this to only include directories you want to watch
|
5
|
+
# directories %w(app lib config test spec features) \
|
6
|
+
# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
7
|
+
|
8
|
+
## Note: if you are using the `directories` clause above and you are not
|
9
|
+
## watching the project directory ('.'), then you will want to move
|
10
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
11
|
+
#
|
12
|
+
# $ mkdir config
|
13
|
+
# $ mv Guardfile config/
|
14
|
+
# $ ln -s config/Guardfile .
|
15
|
+
#
|
16
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
17
|
+
|
18
|
+
guard :bundler do
|
19
|
+
require 'guard/bundler'
|
20
|
+
require 'guard/bundler/verify'
|
21
|
+
helper = Guard::Bundler::Verify.new
|
22
|
+
|
23
|
+
files = ['Gemfile']
|
24
|
+
files += Dir['*.gemspec'] if files.any? { |f| helper.uses_gemspec?(f) }
|
25
|
+
|
26
|
+
# Assume files are symlinked from somewhere
|
27
|
+
files.each { |file| watch(helper.real_path(file)) }
|
28
|
+
end
|
29
|
+
|
30
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
31
|
+
# rspec may be run, below are examples of the most common uses.
|
32
|
+
# * bundler: 'bundle exec rspec'
|
33
|
+
# * bundler binstubs: 'bin/rspec'
|
34
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
35
|
+
# installed the spring binstubs per the docs)
|
36
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
37
|
+
# * 'just' rspec: 'rspec'
|
38
|
+
|
39
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
40
|
+
require "guard/rspec/dsl"
|
41
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
42
|
+
|
43
|
+
# Feel free to open issues for suggestions and improvements
|
44
|
+
|
45
|
+
# RSpec files
|
46
|
+
rspec = dsl.rspec
|
47
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
48
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
49
|
+
watch(rspec.spec_files)
|
50
|
+
|
51
|
+
# Ruby files
|
52
|
+
ruby = dsl.ruby
|
53
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
54
|
+
|
55
|
+
# Rails files
|
56
|
+
rails = dsl.rails(view_extensions: %w(erb haml slim))
|
57
|
+
dsl.watch_spec_files_for(rails.app_files)
|
58
|
+
dsl.watch_spec_files_for(rails.views)
|
59
|
+
|
60
|
+
watch(rails.controllers) do |m|
|
61
|
+
[
|
62
|
+
rspec.spec.call("routing/#{m[1]}_routing"),
|
63
|
+
rspec.spec.call("controllers/#{m[1]}_controller"),
|
64
|
+
rspec.spec.call("acceptance/#{m[1]}")
|
65
|
+
]
|
66
|
+
end
|
67
|
+
|
68
|
+
# Rails config changes
|
69
|
+
watch(rails.spec_helper) { rspec.spec_dir }
|
70
|
+
watch(rails.routes) { "#{rspec.spec_dir}/routing" }
|
71
|
+
watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
|
72
|
+
|
73
|
+
# Capybara features specs
|
74
|
+
watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
|
75
|
+
watch(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") }
|
76
|
+
|
77
|
+
# Turnip features and steps
|
78
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
79
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
|
80
|
+
Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
|
81
|
+
end
|
82
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Angel Igareta
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# Food
|
2
|
+
|
3
|
+
## Descipción del Proyecto
|
4
|
+
|
5
|
+
Para llevar a cabo todos los procesos que nos permiten estar vivos, el organismo humano necesita un
|
6
|
+
suministro continuo de materiales que debemos ingerir: **los nutrientes**. Sin embargo, estos nutrientes
|
7
|
+
no se ingieren directamente, sino que forman parte de los alimentos. Las multiples combinaciones en
|
8
|
+
que la naturaleza ofrece los diferentes nutrientes nos dan una amplia variedad de alimentos que el ser
|
9
|
+
humano puede consumir.
|
10
|
+
|
11
|
+
Se puede hacer una primera distinción entre los componentes de cualquier alimento en base a las
|
12
|
+
cantidades en que estan presentes: los llamados macronutrientes, que son los que ocupan la mayor
|
13
|
+
proporcion de los alimentos, y los llamados micronutrientes, que solo estan presentes en pequeñísimas
|
14
|
+
proporciones. Los macronutrientes son las proteínas, los glucidos (o hidratos de carbono) y los lípidos (o
|
15
|
+
grasas). Tambien se podría incluir a la fibra y al agua, que estan presentes en cantidades considerables
|
16
|
+
en la mayoría de los alimentos, pero como no aportan calorías no suelen considerarse nutrientes. Entre
|
17
|
+
los micronutrientes se encuentran las vitaminas y los minerales.
|
18
|
+
|
19
|
+
El **valor energetico o valor calorico** de un alimento es proporcional a la cantidad de energía que
|
20
|
+
puede proporcionar al quemarse en presencia de oxígeno. Se mide en calorías.Como su valor resulta
|
21
|
+
muy pequeño, en dietetica se toma como medida la kilocaloría (1 Kcal. = 1.000 calorías). Las dietas
|
22
|
+
de los humanos adultos contienen entre 1.000 y 5.000 kilocalorías por día.
|
23
|
+
|
24
|
+
Cada grupo de nutrientes energeticos: glucidos, lípidos o proteínas tiene un valor calórico diferente
|
25
|
+
y mas o menos uniforme en cada grupo. Para facilitar los calculos del valor energetico de los alimentos
|
26
|
+
se toman unos valores estandar para cada grupo:
|
27
|
+
|
28
|
+
+ Cuando el organismo quema 1 g de glucidos obtiene 4 Kcal
|
29
|
+
+ Cuando el organismo quema 1 g de lípidos obtiene 9 Kcal
|
30
|
+
+ Cuando el organismo quema 1 g de proteínas consigue 4 Kcal
|
31
|
+
|
32
|
+
De ahí que los alimentos ricos en grasa tengan un contenido energetico mucho mayor que los formados
|
33
|
+
por glucidos o proteínas. Las vitaminas y los minerales, así como los oligoelementos, el agua y la fibra
|
34
|
+
se considera que no aportan calorías.
|
35
|
+
|
36
|
+
Por ejemplo, un alimento que contenga 10 g de proteína, 20 g
|
37
|
+
de glucidos y 9 g de grasa nos proporcionaría 201 Kcal: 10 × 4 + 20 × 4 + 9 × 9 = 201Kcal.
|
38
|
+
|
39
|
+
---
|
40
|
+
## Requisitos
|
41
|
+
|
42
|
+
+ Debe existir un nombre para el alimento.
|
43
|
+
+ Debe existir la candidad de proteínas del alimento en gramos.
|
44
|
+
+ Debe existir la candidad de glúcidos del alimento en gramos.
|
45
|
+
+ Debe existir la candidad de grasas del alimento en gramos.
|
46
|
+
+ Existe un método para obtener el nombre del alimento.
|
47
|
+
+ Existe un método para obtener la cantidad de proteínas de un alimento.
|
48
|
+
+ Existe un método para obtener la cantidad de glúcidos de un alimento.
|
49
|
+
+ Existe un método para obtener de grasas de un alimento.
|
50
|
+
+ Existe un método para obtener el alimento formateado.
|
51
|
+
+ Existe un método para obtener el valor energético de un alimento.
|
52
|
+
|
53
|
+
---
|
54
|
+
|
55
|
+
## Resultado
|
56
|
+
|
57
|
+
### El resultado de la práctica debe ser una clase Alimento que contenga:
|
58
|
+
|
59
|
+
| Alimento | Proteínas | Glúcidos | Lípidos |
|
60
|
+
| -------------|:----------:|:----------:|:---------:|
|
61
|
+
| Huevo frito | 14.1 | 0.0 | 19.5 |
|
62
|
+
| Leche vaca | 3.3 | 4.8 | 3.2 |
|
63
|
+
| Yogurt | 3.8 | 4.9 | 3.8 |
|
64
|
+
| Cerdo | 21.5 | 0.0 | 6.3 |
|
65
|
+
|
66
|
+
|
67
|
+
---
|
68
|
+
## Licencia
|
69
|
+
|
70
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "food"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|