alimento0101069937 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 0151234cec7f542b9a56aba12e45d93daf331e0d03bf4501d4ee475cc1f56c9b
4
+ data.tar.gz: 5879294efb4af79076b16f39f7d527a35161d10071aa43873c501cc01425bd25
5
+ SHA512:
6
+ metadata.gz: bb8527ac7d2fbc9d9ad0185448d7dd0d1ddd755411ebb60833f5835bbbcf72f9679d0dcb84d60fa0ddc72eeffbc1f73f1c43e4f012503390476f2b52e309836d
7
+ data.tar.gz: c86f839dd71a92e3b0c0891781480831f6e47e9cb160c1030b8b9bd196c2a5a1741e4c9080884a6dff228ebcba3cd7438bf7977a094bfbdbb129682287e0926f
@@ -0,0 +1 @@
1
+ service_name: travis-ci
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *~
11
+ *.old
12
+ *.swp
13
+
14
+ # rspec failure tracking
15
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.0
5
+ before_install: gem install bundler -v 1.15.4
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in alimento.gemspec
6
+ gemspec
@@ -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
@@ -0,0 +1,77 @@
1
+ # Alimento
2
+ Gema usada para representar y calcular el valor energético de un alimento.
3
+
4
+ ##Preparación de la gema
5
+ * Instalar 'bundler'
6
+ *gem install bundler*
7
+ * Instalar 'rspec'
8
+ *gem install rspec*
9
+ * Crear la gema 'alimento'
10
+ *bundle gem alimento*
11
+ * Modificar el fichero 'Gemfile'
12
+ *vim Gemfile*
13
+ <<<<<<< HEAD
14
+ * Añadir a Travis
15
+ =======
16
+ * Incluir acceso con Travis
17
+
18
+ >>>>>>> c984848255ac3b8c372dd54c2e122527b42404c9
19
+
20
+ ## Instalación
21
+
22
+ ```ruby
23
+ gem 'alimento'
24
+ ```
25
+ And then execute:
26
+
27
+ $ bundle
28
+
29
+ Or install it yourself as:
30
+
31
+ $ gem install alimento
32
+
33
+ ## Usage
34
+ La gema 'Alimento' tiene una clase con el mismo nombre, a cuyas instancias se le
35
+ tienen que pasar 4 argumentos:
36
+ * Nombre del alimento
37
+ * % de proteínas
38
+ * % de glúcidos (azúcares)
39
+ * % de lípidos (grasas)
40
+ * cantidad de alimento (gr)
41
+
42
+ Tambien contiene una clase 'List' que representa listas de alimentos, cuyos nodos
43
+ son los alimentos pertenecientes a su grupo (lácteos, carnes, pescados, etc...),
44
+ usando una estructura ('Struct') para representar cada nodo. Dicha lista es del
45
+ tipo "doblemente enlazada".
46
+
47
+ Finalmente, existe una clase por cada grupo de alimentos que heredan de la clase
48
+ 'Alimento': sus atributos y métodos.
49
+
50
+ ## Development
51
+
52
+ De la clase 'Alimento', son accesibles(para lectura) el 'nombre', y las cantidades
53
+ de 'proteinas','glucidos' y 'lipidos' introducidos.
54
+
55
+ Además, 'Alimento' cuenta con los siguientes métodos:
56
+ * alimento.getNombre
57
+ * alimento.grProteinas
58
+ * alimento.grGlucidos
59
+ * alimento.grLipidos
60
+ * alimento.calorias
61
+ * alimento.to_s
62
+
63
+ La clase 'List' tiene accesibles (lectura) el 'head' y el 'tail' de la lista. Que
64
+ a su vez, permiten conocer el 'valor','prev' y 'sigte' del nodo al que "apuntan".
65
+
66
+ Los métodos de la clase 'List' son los siguientes:
67
+ * .insertaNodo (Inserta un nuevo nodo en la lista)
68
+ * .rmHead (Elimina el nodo-cabeza de la lista)
69
+ * .rmTail (Elimina el nodo-cola de la lista)
70
+
71
+ Pruebas realizadas con la herramienta 'rspec'.
72
+ Fichero de pruebas: alimento/spec/alimento_spec.rb
73
+
74
+ ## Contributing
75
+
76
+ Bug reports and pull requests are welcome on GitHub at https://github.com/ULL-ESIT-LPP-1718/tdd-alu0101069937.
77
+
@@ -0,0 +1,17 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ #RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
7
+
8
+ desc "Ejecutar las espectativas de la clase 'Alimento'"
9
+ task :spec do
10
+ sh "rspec -I. spec/alimento_spec.rb"
11
+ end
12
+
13
+ desc "Ejecutar las espectativas de 'Alimento' con documentación"
14
+ task :doc do
15
+ sh "rspec -I. spec/alimento_spec.rb --format documentation"
16
+ end
17
+
@@ -0,0 +1,38 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "alimento/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "alimento0101069937"
8
+ spec.version = Alimento::VERSION
9
+ spec.authors = ["alu0101069937"]
10
+ spec.email = ["alu0101069937@ull.edu.es"]
11
+
12
+ spec.summary = %q{Calculo de nutrientes de un alimento}
13
+ #spec.description = %q{TODO: Write a longer description or delete this line.}
14
+ spec.homepage = "https://github.com/ULL-ESIT-LPP-1718/tdd-alu0101069937.git"
15
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
16
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
17
+ if spec.respond_to?(:metadata)
18
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
19
+ else
20
+ raise "RubyGems 2.0 or newer is required to protect against " \
21
+ "public gem pushes."
22
+ end
23
+
24
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
25
+ f.match(%r{^(test|spec|features)/})
26
+ end
27
+ spec.bindir = "exe"
28
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
+ spec.require_paths = ["lib"]
30
+
31
+ spec.add_development_dependency "bundler", "~> 1.15"
32
+ spec.add_development_dependency "rake", "~> 10.0"
33
+ spec.add_development_dependency "rspec", "~> 3.0"
34
+ spec.add_development_dependency "guard"
35
+ spec.add_development_dependency "guard-rspec"
36
+ spec.add_development_dependency "guard-bundler"
37
+ spec.add_development_dependency "coveralls"
38
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "alimento"
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__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,152 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Module: Alimento
8
+
9
+ &mdash; Documentation by YARD 0.9.9
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ pathId = "Alimento";
19
+ relpath = '';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="_index.html">Index (A)</a> &raquo;
40
+
41
+
42
+ <span class="title">Alimento</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Module: Alimento
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+ <dl>
80
+ <dt>Defined in:</dt>
81
+ <dd>lib/alimento/fuente.rb<span class="defines">,<br />
82
+ lib/alimento.rb,<br /> lib/alimento/version.rb</span>
83
+ </dd>
84
+ </dl>
85
+
86
+ </div>
87
+
88
+ <h2>Overview</h2><div class="docstring">
89
+ <div class="discussion">
90
+
91
+ <p>Módulo creado para describir y representar alimentos haciendo uso del
92
+ Lenguaje de Programación Ruby.</p>
93
+
94
+ <p>En él se han desarrollado las prácticas #6, #7 y #8 de la asignatura
95
+ Lenguajes y Paradigmas de Programación.</p>
96
+ <dl class="rdoc-list note-list"><dt>Author
97
+ <dd>
98
+ <p>Santiago Padilla (<a href="mailto:S.Padilla@x.y">S.Padilla@x.y</a>)</p>
99
+ </dd><dt>Copyright
100
+ <dd>
101
+ <p>Cretive Commons</p>
102
+ </dd><dt>License
103
+ <dd>
104
+ <p>Distributes under the same terms as Ruby</p>
105
+ </dd></dl>
106
+
107
+
108
+ </div>
109
+ </div>
110
+ <div class="tags">
111
+
112
+
113
+ </div><h2>Defined Under Namespace</h2>
114
+ <p class="children">
115
+
116
+
117
+
118
+
119
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Alimento/Alimento.html" title="Alimento::Alimento (class)">Alimento</a></span>, <span class='object_link'><a href="Alimento/Carbohidratos.html" title="Alimento::Carbohidratos (class)">Carbohidratos</a></span>, <span class='object_link'><a href="Alimento/Carnes.html" title="Alimento::Carnes (class)">Carnes</a></span>, <span class='object_link'><a href="Alimento/Frutas.html" title="Alimento::Frutas (class)">Frutas</a></span>, <span class='object_link'><a href="Alimento/Grasos.html" title="Alimento::Grasos (class)">Grasos</a></span>, <span class='object_link'><a href="Alimento/Lacteos.html" title="Alimento::Lacteos (class)">Lacteos</a></span>, <span class='object_link'><a href="Alimento/List.html" title="Alimento::List (class)">List</a></span>, <span class='object_link'><a href="Alimento/Pescados.html" title="Alimento::Pescados (class)">Pescados</a></span>, <span class='object_link'><a href="Alimento/Verduras.html" title="Alimento::Verduras (class)">Verduras</a></span>
120
+
121
+
122
+ </p>
123
+
124
+ <h2>Constant Summary</h2>
125
+ <dl class="constants">
126
+
127
+ <dt id="VERSION-constant" class="">VERSION =
128
+
129
+ </dt>
130
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>0.1.0</span><span class='tstring_end'>&quot;</span></span></pre></dd>
131
+
132
+ </dl>
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+ </div>
143
+
144
+ <div id="footer">
145
+ Generated on Wed Nov 15 12:49:30 2017 by
146
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
147
+ 0.9.9 (ruby-2.3.0).
148
+ </div>
149
+
150
+ </div>
151
+ </body>
152
+ </html>
@@ -0,0 +1,931 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Class: Alimento::Alimento
8
+
9
+ &mdash; Documentation by YARD 0.9.9
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ pathId = "Alimento::Alimento";
19
+ relpath = '../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../_index.html">Index (A)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../Alimento.html" title="Alimento (module)">Alimento</a></span></span>
41
+ &raquo;
42
+ <span class="title">Alimento</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Class: Alimento::Alimento
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName">Object</span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next">Alimento::Alimento</li>
78
+
79
+ </ul>
80
+ <a href="#" class="inheritanceTree">show all</a>
81
+
82
+ </dd>
83
+ </dl>
84
+
85
+
86
+
87
+
88
+
89
+
90
+ <dl>
91
+ <dt>Includes:</dt>
92
+ <dd>Comparable</dd>
93
+ </dl>
94
+
95
+
96
+
97
+
98
+
99
+
100
+ <dl>
101
+ <dt>Defined in:</dt>
102
+ <dd>lib/alimento/fuente.rb</dd>
103
+ </dl>
104
+
105
+ </div>
106
+
107
+ <h2>Overview</h2><div class="docstring">
108
+ <div class="discussion">
109
+
110
+ <p>Esta clase permite representar un alimento con sus nutrientes, así como
111
+ calcular sus calorías. Todo ello en función de la cantidad de alimento que
112
+ especifiquemos (por defecto: 100gr) Se ha incluido el mixin Comparable, que
113
+ permite comparar los alimentos en función de su aporte calórico</p>
114
+
115
+
116
+ </div>
117
+ </div>
118
+ <div class="tags">
119
+
120
+
121
+ </div><div id="subclasses">
122
+ <h2>Direct Known Subclasses</h2>
123
+ <p class="children"><span class='object_link'><a href="Carbohidratos.html" title="Alimento::Carbohidratos (class)">Carbohidratos</a></span>, <span class='object_link'><a href="Carnes.html" title="Alimento::Carnes (class)">Carnes</a></span>, <span class='object_link'><a href="Frutas.html" title="Alimento::Frutas (class)">Frutas</a></span>, <span class='object_link'><a href="Grasos.html" title="Alimento::Grasos (class)">Grasos</a></span>, <span class='object_link'><a href="Lacteos.html" title="Alimento::Lacteos (class)">Lacteos</a></span>, <span class='object_link'><a href="Pescados.html" title="Alimento::Pescados (class)">Pescados</a></span>, <span class='object_link'><a href="Verduras.html" title="Alimento::Verduras (class)">Verduras</a></span></p>
124
+ </div>
125
+
126
+
127
+
128
+
129
+ <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
130
+ <ul class="summary">
131
+
132
+ <li class="public ">
133
+ <span class="summary_signature">
134
+
135
+ <a href="#glucidos-instance_method" title="#glucidos (instance method)">#<strong>glucidos</strong> &#x21d2; Object </a>
136
+
137
+
138
+
139
+ </span>
140
+
141
+
142
+
143
+
144
+ <span class="note title readonly">readonly</span>
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+ <span class="summary_desc"><div class='inline'>
155
+ <p>Returns the value of attribute glucidos.</p>
156
+ </div></span>
157
+
158
+ </li>
159
+
160
+
161
+ <li class="public ">
162
+ <span class="summary_signature">
163
+
164
+ <a href="#lipidos-instance_method" title="#lipidos (instance method)">#<strong>lipidos</strong> &#x21d2; Object </a>
165
+
166
+
167
+
168
+ </span>
169
+
170
+
171
+
172
+
173
+ <span class="note title readonly">readonly</span>
174
+
175
+
176
+
177
+
178
+
179
+
180
+
181
+
182
+
183
+ <span class="summary_desc"><div class='inline'>
184
+ <p>Returns the value of attribute lipidos.</p>
185
+ </div></span>
186
+
187
+ </li>
188
+
189
+
190
+ <li class="public ">
191
+ <span class="summary_signature">
192
+
193
+ <a href="#nombre-instance_method" title="#nombre (instance method)">#<strong>nombre</strong> &#x21d2; Object </a>
194
+
195
+
196
+
197
+ </span>
198
+
199
+
200
+
201
+
202
+ <span class="note title readonly">readonly</span>
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+
211
+
212
+ <span class="summary_desc"><div class='inline'>
213
+ <p>Returns the value of attribute nombre.</p>
214
+ </div></span>
215
+
216
+ </li>
217
+
218
+
219
+ <li class="public ">
220
+ <span class="summary_signature">
221
+
222
+ <a href="#proteinas-instance_method" title="#proteinas (instance method)">#<strong>proteinas</strong> &#x21d2; Object </a>
223
+
224
+
225
+
226
+ </span>
227
+
228
+
229
+
230
+
231
+ <span class="note title readonly">readonly</span>
232
+
233
+
234
+
235
+
236
+
237
+
238
+
239
+
240
+
241
+ <span class="summary_desc"><div class='inline'>
242
+ <p>Returns the value of attribute proteinas.</p>
243
+ </div></span>
244
+
245
+ </li>
246
+
247
+
248
+ </ul>
249
+
250
+
251
+
252
+
253
+
254
+ <h2>
255
+ Instance Method Summary
256
+ <small><a href="#" class="summary_toggle">collapse</a></small>
257
+ </h2>
258
+
259
+ <ul class="summary">
260
+
261
+ <li class="public ">
262
+ <span class="summary_signature">
263
+
264
+ <a href="#<=>-instance_method" title="#&lt;=&gt; (instance method)">#<strong>&lt;=&gt;</strong>(otroAlimento) &#x21d2; Object </a>
265
+
266
+
267
+
268
+ </span>
269
+
270
+
271
+
272
+
273
+
274
+
275
+
276
+
277
+
278
+ <span class="summary_desc"><div class='inline'>
279
+ <p>Método necesario para usar &#39;Comparable&#39;.</p>
280
+ </div></span>
281
+
282
+ </li>
283
+
284
+
285
+ <li class="public ">
286
+ <span class="summary_signature">
287
+
288
+ <a href="#calorias-instance_method" title="#calorias (instance method)">#<strong>calorias</strong> &#x21d2; Object </a>
289
+
290
+
291
+
292
+ </span>
293
+
294
+
295
+
296
+
297
+
298
+
299
+
300
+
301
+
302
+ <span class="summary_desc"><div class='inline'>
303
+ <p>Calcula las calorías del alimento según sus nutrientes.</p>
304
+ </div></span>
305
+
306
+ </li>
307
+
308
+
309
+ <li class="public ">
310
+ <span class="summary_signature">
311
+
312
+ <a href="#grGlucidos-instance_method" title="#grGlucidos (instance method)">#<strong>grGlucidos</strong> &#x21d2; Object </a>
313
+
314
+
315
+
316
+ </span>
317
+
318
+
319
+
320
+
321
+
322
+
323
+
324
+
325
+
326
+ <span class="summary_desc"><div class='inline'>
327
+ <p>Calcula cantidad (gr) de azúcares del alimento.</p>
328
+ </div></span>
329
+
330
+ </li>
331
+
332
+
333
+ <li class="public ">
334
+ <span class="summary_signature">
335
+
336
+ <a href="#grLipidos-instance_method" title="#grLipidos (instance method)">#<strong>grLipidos</strong> &#x21d2; Object </a>
337
+
338
+
339
+
340
+ </span>
341
+
342
+
343
+
344
+
345
+
346
+
347
+
348
+
349
+
350
+ <span class="summary_desc"><div class='inline'>
351
+ <p>Calcula cantidad (gr) de grasas del alimento.</p>
352
+ </div></span>
353
+
354
+ </li>
355
+
356
+
357
+ <li class="public ">
358
+ <span class="summary_signature">
359
+
360
+ <a href="#grProteinas-instance_method" title="#grProteinas (instance method)">#<strong>grProteinas</strong> &#x21d2; Object </a>
361
+
362
+
363
+
364
+ </span>
365
+
366
+
367
+
368
+
369
+
370
+
371
+
372
+
373
+
374
+ <span class="summary_desc"><div class='inline'>
375
+ <p>Calcula cantidad (gr) de proteína del alimento.</p>
376
+ </div></span>
377
+
378
+ </li>
379
+
380
+
381
+ <li class="public ">
382
+ <span class="summary_signature">
383
+
384
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(nombre, proteinas, glucidos, lipidos, cantidad = 100) &#x21d2; Alimento </a>
385
+
386
+
387
+
388
+ </span>
389
+
390
+
391
+ <span class="note title constructor">constructor</span>
392
+
393
+
394
+
395
+
396
+
397
+
398
+
399
+
400
+ <span class="summary_desc"><div class='inline'>
401
+ <p>Se asignan el nombre y los nutrientes del alimento, así como la cantidad en
402
+ gramos (por defecto: 100gr).</p>
403
+ </div></span>
404
+
405
+ </li>
406
+
407
+
408
+ <li class="public ">
409
+ <span class="summary_signature">
410
+
411
+ <a href="#to_s-instance_method" title="#to_s (instance method)">#<strong>to_s</strong> &#x21d2; Object </a>
412
+
413
+
414
+
415
+ </span>
416
+
417
+
418
+
419
+
420
+
421
+
422
+
423
+
424
+
425
+ <span class="summary_desc"><div class='inline'>
426
+ <p>Da formato a la presentación del alimento.</p>
427
+ </div></span>
428
+
429
+ </li>
430
+
431
+
432
+ </ul>
433
+
434
+
435
+
436
+ <div id="constructor_details" class="method_details_list">
437
+ <h2>Constructor Details</h2>
438
+
439
+ <div class="method_details first">
440
+ <h3 class="signature first" id="initialize-instance_method">
441
+
442
+ #<strong>initialize</strong>(nombre, proteinas, glucidos, lipidos, cantidad = 100) &#x21d2; <tt><span class='object_link'><a href="" title="Alimento::Alimento (class)">Alimento</a></span></tt>
443
+
444
+
445
+
446
+
447
+
448
+ </h3><div class="docstring">
449
+ <div class="discussion">
450
+
451
+ <p>Se asignan el nombre y los nutrientes del alimento, así como la cantidad en
452
+ gramos (por defecto: 100gr)</p>
453
+
454
+
455
+ </div>
456
+ </div>
457
+ <div class="tags">
458
+
459
+
460
+ </div><table class="source_code">
461
+ <tr>
462
+ <td>
463
+ <pre class="lines">
464
+
465
+
466
+ 31
467
+ 32
468
+ 33
469
+ 34
470
+ 35
471
+ 36
472
+ 37</pre>
473
+ </td>
474
+ <td>
475
+ <pre class="code"><span class="info file"># File 'lib/alimento/fuente.rb', line 31</span>
476
+
477
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_nombre'>nombre</span><span class='comma'>,</span><span class='id identifier rubyid_proteinas'>proteinas</span><span class='comma'>,</span><span class='id identifier rubyid_glucidos'>glucidos</span><span class='comma'>,</span><span class='id identifier rubyid_lipidos'>lipidos</span><span class='comma'>,</span><span class='id identifier rubyid_cantidad'>cantidad</span><span class='op'>=</span><span class='int'>100</span><span class='rparen'>)</span>
478
+ <span class='ivar'>@nombre</span><span class='op'>=</span> <span class='id identifier rubyid_nombre'>nombre</span>
479
+ <span class='ivar'>@proteinas</span><span class='op'>=</span> <span class='id identifier rubyid_proteinas'>proteinas</span>
480
+ <span class='ivar'>@glucidos</span><span class='op'>=</span> <span class='id identifier rubyid_glucidos'>glucidos</span>
481
+ <span class='ivar'>@lipidos</span><span class='op'>=</span> <span class='id identifier rubyid_lipidos'>lipidos</span>
482
+ <span class='ivar'>@cantidad</span><span class='op'>=</span> <span class='id identifier rubyid_cantidad'>cantidad</span>
483
+ <span class='kw'>end</span></pre>
484
+ </td>
485
+ </tr>
486
+ </table>
487
+ </div>
488
+
489
+ </div>
490
+
491
+ <div id="instance_attr_details" class="attr_details">
492
+ <h2>Instance Attribute Details</h2>
493
+
494
+
495
+ <span id=""></span>
496
+ <div class="method_details first">
497
+ <h3 class="signature first" id="glucidos-instance_method">
498
+
499
+ #<strong>glucidos</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
500
+
501
+
502
+
503
+
504
+
505
+ </h3><div class="docstring">
506
+ <div class="discussion">
507
+
508
+ <p>Returns the value of attribute glucidos</p>
509
+
510
+
511
+ </div>
512
+ </div>
513
+ <div class="tags">
514
+
515
+
516
+ </div><table class="source_code">
517
+ <tr>
518
+ <td>
519
+ <pre class="lines">
520
+
521
+
522
+ 21
523
+ 22
524
+ 23</pre>
525
+ </td>
526
+ <td>
527
+ <pre class="code"><span class="info file"># File 'lib/alimento/fuente.rb', line 21</span>
528
+
529
+ <span class='kw'>def</span> <span class='id identifier rubyid_glucidos'>glucidos</span>
530
+ <span class='ivar'>@glucidos</span>
531
+ <span class='kw'>end</span></pre>
532
+ </td>
533
+ </tr>
534
+ </table>
535
+ </div>
536
+
537
+
538
+ <span id=""></span>
539
+ <div class="method_details ">
540
+ <h3 class="signature " id="lipidos-instance_method">
541
+
542
+ #<strong>lipidos</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
543
+
544
+
545
+
546
+
547
+
548
+ </h3><div class="docstring">
549
+ <div class="discussion">
550
+
551
+ <p>Returns the value of attribute lipidos</p>
552
+
553
+
554
+ </div>
555
+ </div>
556
+ <div class="tags">
557
+
558
+
559
+ </div><table class="source_code">
560
+ <tr>
561
+ <td>
562
+ <pre class="lines">
563
+
564
+
565
+ 21
566
+ 22
567
+ 23</pre>
568
+ </td>
569
+ <td>
570
+ <pre class="code"><span class="info file"># File 'lib/alimento/fuente.rb', line 21</span>
571
+
572
+ <span class='kw'>def</span> <span class='id identifier rubyid_lipidos'>lipidos</span>
573
+ <span class='ivar'>@lipidos</span>
574
+ <span class='kw'>end</span></pre>
575
+ </td>
576
+ </tr>
577
+ </table>
578
+ </div>
579
+
580
+
581
+ <span id=""></span>
582
+ <div class="method_details ">
583
+ <h3 class="signature " id="nombre-instance_method">
584
+
585
+ #<strong>nombre</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
586
+
587
+
588
+
589
+
590
+
591
+ </h3><div class="docstring">
592
+ <div class="discussion">
593
+
594
+ <p>Returns the value of attribute nombre</p>
595
+
596
+
597
+ </div>
598
+ </div>
599
+ <div class="tags">
600
+
601
+
602
+ </div><table class="source_code">
603
+ <tr>
604
+ <td>
605
+ <pre class="lines">
606
+
607
+
608
+ 21
609
+ 22
610
+ 23</pre>
611
+ </td>
612
+ <td>
613
+ <pre class="code"><span class="info file"># File 'lib/alimento/fuente.rb', line 21</span>
614
+
615
+ <span class='kw'>def</span> <span class='id identifier rubyid_nombre'>nombre</span>
616
+ <span class='ivar'>@nombre</span>
617
+ <span class='kw'>end</span></pre>
618
+ </td>
619
+ </tr>
620
+ </table>
621
+ </div>
622
+
623
+
624
+ <span id=""></span>
625
+ <div class="method_details ">
626
+ <h3 class="signature " id="proteinas-instance_method">
627
+
628
+ #<strong>proteinas</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
629
+
630
+
631
+
632
+
633
+
634
+ </h3><div class="docstring">
635
+ <div class="discussion">
636
+
637
+ <p>Returns the value of attribute proteinas</p>
638
+
639
+
640
+ </div>
641
+ </div>
642
+ <div class="tags">
643
+
644
+
645
+ </div><table class="source_code">
646
+ <tr>
647
+ <td>
648
+ <pre class="lines">
649
+
650
+
651
+ 21
652
+ 22
653
+ 23</pre>
654
+ </td>
655
+ <td>
656
+ <pre class="code"><span class="info file"># File 'lib/alimento/fuente.rb', line 21</span>
657
+
658
+ <span class='kw'>def</span> <span class='id identifier rubyid_proteinas'>proteinas</span>
659
+ <span class='ivar'>@proteinas</span>
660
+ <span class='kw'>end</span></pre>
661
+ </td>
662
+ </tr>
663
+ </table>
664
+ </div>
665
+
666
+ </div>
667
+
668
+
669
+ <div id="instance_method_details" class="method_details_list">
670
+ <h2>Instance Method Details</h2>
671
+
672
+
673
+ <div class="method_details first">
674
+ <h3 class="signature first" id="<=>-instance_method">
675
+
676
+ #<strong>&lt;=&gt;</strong>(otroAlimento) &#x21d2; <tt>Object</tt>
677
+
678
+
679
+
680
+
681
+
682
+ </h3><div class="docstring">
683
+ <div class="discussion">
684
+
685
+ <p>Método necesario para usar &#39;Comparable&#39;</p>
686
+
687
+
688
+ </div>
689
+ </div>
690
+ <div class="tags">
691
+
692
+
693
+ </div><table class="source_code">
694
+ <tr>
695
+ <td>
696
+ <pre class="lines">
697
+
698
+
699
+ 25
700
+ 26
701
+ 27</pre>
702
+ </td>
703
+ <td>
704
+ <pre class="code"><span class="info file"># File 'lib/alimento/fuente.rb', line 25</span>
705
+
706
+ <span class='kw'>def</span> <span class='op'>&lt;=&gt;</span> <span class='id identifier rubyid_otroAlimento'>otroAlimento</span>
707
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_calorias'>calorias</span> <span class='op'>&lt;=&gt;</span> <span class='id identifier rubyid_otroAlimento'>otroAlimento</span><span class='period'>.</span><span class='id identifier rubyid_calorias'>calorias</span>
708
+ <span class='kw'>end</span></pre>
709
+ </td>
710
+ </tr>
711
+ </table>
712
+ </div>
713
+
714
+ <div class="method_details ">
715
+ <h3 class="signature " id="calorias-instance_method">
716
+
717
+ #<strong>calorias</strong> &#x21d2; <tt>Object</tt>
718
+
719
+
720
+
721
+
722
+
723
+ </h3><div class="docstring">
724
+ <div class="discussion">
725
+
726
+ <p>Calcula las calorías del alimento según sus nutrientes</p>
727
+
728
+
729
+ </div>
730
+ </div>
731
+ <div class="tags">
732
+
733
+
734
+ </div><table class="source_code">
735
+ <tr>
736
+ <td>
737
+ <pre class="lines">
738
+
739
+
740
+ 60
741
+ 61
742
+ 62</pre>
743
+ </td>
744
+ <td>
745
+ <pre class="code"><span class="info file"># File 'lib/alimento/fuente.rb', line 60</span>
746
+
747
+ <span class='kw'>def</span> <span class='id identifier rubyid_calorias'>calorias</span>
748
+ <span class='lparen'>(</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_grProteinas'>grProteinas</span><span class='op'>+</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_grGlucidos'>grGlucidos</span><span class='rparen'>)</span><span class='op'>*</span><span class='int'>4</span> <span class='op'>+</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_grLipidos'>grLipidos</span><span class='op'>*</span><span class='int'>9</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_round'>round</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span>
749
+ <span class='kw'>end</span></pre>
750
+ </td>
751
+ </tr>
752
+ </table>
753
+ </div>
754
+
755
+ <div class="method_details ">
756
+ <h3 class="signature " id="grGlucidos-instance_method">
757
+
758
+ #<strong>grGlucidos</strong> &#x21d2; <tt>Object</tt>
759
+
760
+
761
+
762
+
763
+
764
+ </h3><div class="docstring">
765
+ <div class="discussion">
766
+
767
+ <p>Calcula cantidad (gr) de azúcares del alimento</p>
768
+
769
+
770
+ </div>
771
+ </div>
772
+ <div class="tags">
773
+
774
+
775
+ </div><table class="source_code">
776
+ <tr>
777
+ <td>
778
+ <pre class="lines">
779
+
780
+
781
+ 45
782
+ 46
783
+ 47</pre>
784
+ </td>
785
+ <td>
786
+ <pre class="code"><span class="info file"># File 'lib/alimento/fuente.rb', line 45</span>
787
+
788
+ <span class='kw'>def</span> <span class='id identifier rubyid_grGlucidos'>grGlucidos</span>
789
+ <span class='lparen'>(</span><span class='id identifier rubyid_glucidos'>glucidos</span><span class='op'>*</span><span class='ivar'>@cantidad</span><span class='op'>/</span><span class='int'>100</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_round'>round</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span>
790
+ <span class='kw'>end</span></pre>
791
+ </td>
792
+ </tr>
793
+ </table>
794
+ </div>
795
+
796
+ <div class="method_details ">
797
+ <h3 class="signature " id="grLipidos-instance_method">
798
+
799
+ #<strong>grLipidos</strong> &#x21d2; <tt>Object</tt>
800
+
801
+
802
+
803
+
804
+
805
+ </h3><div class="docstring">
806
+ <div class="discussion">
807
+
808
+ <p>Calcula cantidad (gr) de grasas del alimento</p>
809
+
810
+
811
+ </div>
812
+ </div>
813
+ <div class="tags">
814
+
815
+
816
+ </div><table class="source_code">
817
+ <tr>
818
+ <td>
819
+ <pre class="lines">
820
+
821
+
822
+ 50
823
+ 51
824
+ 52</pre>
825
+ </td>
826
+ <td>
827
+ <pre class="code"><span class="info file"># File 'lib/alimento/fuente.rb', line 50</span>
828
+
829
+ <span class='kw'>def</span> <span class='id identifier rubyid_grLipidos'>grLipidos</span>
830
+ <span class='lparen'>(</span><span class='id identifier rubyid_lipidos'>lipidos</span><span class='op'>*</span><span class='ivar'>@cantidad</span><span class='op'>/</span><span class='int'>100</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_round'>round</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span>
831
+ <span class='kw'>end</span></pre>
832
+ </td>
833
+ </tr>
834
+ </table>
835
+ </div>
836
+
837
+ <div class="method_details ">
838
+ <h3 class="signature " id="grProteinas-instance_method">
839
+
840
+ #<strong>grProteinas</strong> &#x21d2; <tt>Object</tt>
841
+
842
+
843
+
844
+
845
+
846
+ </h3><div class="docstring">
847
+ <div class="discussion">
848
+
849
+ <p>Calcula cantidad (gr) de proteína del alimento</p>
850
+
851
+
852
+ </div>
853
+ </div>
854
+ <div class="tags">
855
+
856
+
857
+ </div><table class="source_code">
858
+ <tr>
859
+ <td>
860
+ <pre class="lines">
861
+
862
+
863
+ 40
864
+ 41
865
+ 42</pre>
866
+ </td>
867
+ <td>
868
+ <pre class="code"><span class="info file"># File 'lib/alimento/fuente.rb', line 40</span>
869
+
870
+ <span class='kw'>def</span> <span class='id identifier rubyid_grProteinas'>grProteinas</span>
871
+ <span class='lparen'>(</span><span class='id identifier rubyid_proteinas'>proteinas</span><span class='op'>*</span><span class='ivar'>@cantidad</span><span class='op'>/</span><span class='int'>100</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_round'>round</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span>
872
+ <span class='kw'>end</span></pre>
873
+ </td>
874
+ </tr>
875
+ </table>
876
+ </div>
877
+
878
+ <div class="method_details ">
879
+ <h3 class="signature " id="to_s-instance_method">
880
+
881
+ #<strong>to_s</strong> &#x21d2; <tt>Object</tt>
882
+
883
+
884
+
885
+
886
+
887
+ </h3><div class="docstring">
888
+ <div class="discussion">
889
+
890
+ <p>Da formato a la presentación del alimento</p>
891
+
892
+
893
+ </div>
894
+ </div>
895
+ <div class="tags">
896
+
897
+
898
+ </div><table class="source_code">
899
+ <tr>
900
+ <td>
901
+ <pre class="lines">
902
+
903
+
904
+ 55
905
+ 56
906
+ 57</pre>
907
+ </td>
908
+ <td>
909
+ <pre class="code"><span class="info file"># File 'lib/alimento/fuente.rb', line 55</span>
910
+
911
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_s'>to_s</span>
912
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_nombre'>nombre</span><span class='embexpr_end'>}</span><span class='tstring_content'>[</span><span class='embexpr_beg'>#{</span><span class='ivar'>@cantidad</span><span class='embexpr_end'>}</span><span class='tstring_content'>gr](Pr_</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_grProteinas'>grProteinas</span><span class='embexpr_end'>}</span><span class='tstring_content'>, Glc_</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_grGlucidos'>grGlucidos</span><span class='embexpr_end'>}</span><span class='tstring_content'>, Lip_</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_grLipidos'>grLipidos</span><span class='embexpr_end'>}</span><span class='tstring_content'>)</span><span class='tstring_end'>&quot;</span></span>
913
+ <span class='kw'>end</span></pre>
914
+ </td>
915
+ </tr>
916
+ </table>
917
+ </div>
918
+
919
+ </div>
920
+
921
+ </div>
922
+
923
+ <div id="footer">
924
+ Generated on Wed Nov 15 12:49:30 2017 by
925
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
926
+ 0.9.9 (ruby-2.3.0).
927
+ </div>
928
+
929
+ </div>
930
+ </body>
931
+ </html>