alimento-alu0100947441 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b7096ab7a37885a05cd8c85020064122786a1387
4
+ data.tar.gz: 7fc0ec0bbebef9d0abba1efe733c5735dbde29de
5
+ SHA512:
6
+ metadata.gz: 0abfb4b9986e8979d106cb8734f12b88286abbf45c4b30c2535724e41f110bdd19113616e9af6038f9e2e9afb1e7b8ea68f8c4131c0bf6940e46baa9b79d1399
7
+ data.tar.gz: 5db53426403e0be5806a50f97c1a88b65eb5285f8bfc9db00cd1180ded54c55c1120e7fe5ff4708c8584e115bd49adba64a8e22c1a47ca6a5f8392fff7d1e76b
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service-name: travis-pro
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ # Fichero .gitignore
2
+
3
+ /.bundle/
4
+ /.yardoc
5
+ /Gemfile.lock
6
+ /_yardoc/
7
+ /coverage/
8
+ /doc/
9
+ /pkg/
10
+ /spec/reports/
11
+ /tmp/
12
+ *.swp
13
+
14
+ # rspec failure tracking
15
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.2.2
5
+ - 2.3.1
6
+ - 2.4.1
7
+ 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/ULL-ESIT-LPP-1718/tdd-alu0100947441" }
4
+
5
+ # Specify your gem's dependencies in alimento.gemspec
6
+ gemspec
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/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # Alimento
2
+
3
+ Desarrollo de la gema 'Alimento'. Se trata de una calculadora de calorías muy básica, pues la complejidad del proyecto radica en la utilización de la herramienta Bundler y la metodología de desarrollo dirigido por pruebas.
4
+
5
+ ## Contributing
6
+
7
+ Bug reports and pull requests are welcome on GitHub at https://github.com/ULL-ESIT-LPP-1718/tdd-alu0100947441.
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/alimento.gemspec ADDED
@@ -0,0 +1,42 @@
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 = "alimento-alu0100947441"
8
+ spec.version = Alimento::VERSION
9
+ spec.authors = ["Sara Revilla"]
10
+ spec.email = ["alu0100947441@ull.edu.es"]
11
+
12
+ spec.summary = %q{Clase Alimento: Calculadora de calorías.}
13
+ spec.description = %q{Calculadora de calorías de macronutrientes muy básica.}
14
+ spec.homepage = "https://github.com/ULL-ESIT-LPP-1718/tdd-alu0100947441"
15
+
16
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
18
+ #if spec.respond_to?(:metadata)
19
+ # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
20
+ #else
21
+ # raise "RubyGems 2.0 or newer is required to protect against " \
22
+ # "public gem pushes."
23
+ #end
24
+
25
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
26
+ f.match(%r{^(test|spec|features)/})
27
+ end
28
+ spec.bindir = "exe"
29
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
30
+ spec.require_paths = ["lib"]
31
+
32
+ spec.add_development_dependency "bundler", "~> 1.15"
33
+ spec.add_development_dependency "rake", "~> 10.0"
34
+ spec.add_development_dependency "rspec", "~> 3.0"
35
+ spec.add_development_dependency "guard"
36
+ spec.add_development_dependency "guard-rspec"
37
+ spec.add_development_dependency "guard-bundler"
38
+ spec.add_development_dependency "yard"
39
+ spec.add_development_dependency "yard-rspec"
40
+ spec.add_development_dependency "coveralls"
41
+
42
+ end
data/bin/console ADDED
@@ -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__)
data/bin/setup ADDED
@@ -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,157 @@
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/alimento.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>Este módulo</p>
92
+
93
+ <p>se ha desarrollado para practicar la metodología de desarrollo dirigido
94
+ por pruebas, así como el uso de diversas herramientas de Ruby.</p>
95
+
96
+
97
+ </div>
98
+ </div>
99
+ <div class="tags">
100
+
101
+ <p class="tag_title">Author:</p>
102
+ <ul class="author">
103
+
104
+ <li>
105
+
106
+
107
+
108
+
109
+
110
+ <div class='inline'>
111
+ <p>Sara Revilla</p>
112
+ </div>
113
+
114
+ </li>
115
+
116
+ </ul>
117
+
118
+ </div><h2>Defined Under Namespace</h2>
119
+ <p class="children">
120
+
121
+
122
+
123
+
124
+ <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/GrupoAlimento.html" title="Alimento::GrupoAlimento (class)">GrupoAlimento</a></span>
125
+
126
+
127
+ </p>
128
+
129
+ <h2>Constant Summary</h2>
130
+ <dl class="constants">
131
+
132
+ <dt id="VERSION-constant" class="">VERSION =
133
+
134
+ </dt>
135
+ <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>
136
+
137
+ </dl>
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+ </div>
148
+
149
+ <div id="footer">
150
+ Generated on Fri Nov 17 00:34:35 2017 by
151
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
152
+ 0.9.9 (ruby-2.3.0).
153
+ </div>
154
+
155
+ </div>
156
+ </body>
157
+ </html>
@@ -0,0 +1,927 @@
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/alimento.rb</dd>
103
+ </dl>
104
+
105
+ </div>
106
+
107
+ <h2>Overview</h2><div class="docstring">
108
+ <div class="discussion">
109
+
110
+ <p>Esta clase representa un alimento y sus macroelementos.</p>
111
+
112
+
113
+ </div>
114
+ </div>
115
+ <div class="tags">
116
+
117
+
118
+ </div><div id="subclasses">
119
+ <h2>Direct Known Subclasses</h2>
120
+ <p class="children"><span class='object_link'><a href="GrupoAlimento.html" title="Alimento::GrupoAlimento (class)">GrupoAlimento</a></span></p>
121
+ </div>
122
+
123
+
124
+
125
+
126
+ <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
127
+ <ul class="summary">
128
+
129
+ <li class="public ">
130
+ <span class="summary_signature">
131
+
132
+ <a href="#gluc-instance_method" title="#gluc (instance method)">#<strong>gluc</strong> &#x21d2; Object </a>
133
+
134
+
135
+
136
+ </span>
137
+
138
+
139
+
140
+
141
+ <span class="note title readonly">readonly</span>
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+ <span class="summary_desc"><div class='inline'>
152
+ <p>Returns the value of attribute gluc.</p>
153
+ </div></span>
154
+
155
+ </li>
156
+
157
+
158
+ <li class="public ">
159
+ <span class="summary_signature">
160
+
161
+ <a href="#gras-instance_method" title="#gras (instance method)">#<strong>gras</strong> &#x21d2; Object </a>
162
+
163
+
164
+
165
+ </span>
166
+
167
+
168
+
169
+
170
+ <span class="note title readonly">readonly</span>
171
+
172
+
173
+
174
+
175
+
176
+
177
+
178
+
179
+
180
+ <span class="summary_desc"><div class='inline'>
181
+ <p>Returns the value of attribute gras.</p>
182
+ </div></span>
183
+
184
+ </li>
185
+
186
+
187
+ <li class="public ">
188
+ <span class="summary_signature">
189
+
190
+ <a href="#nombre-instance_method" title="#nombre (instance method)">#<strong>nombre</strong> &#x21d2; Object </a>
191
+
192
+
193
+
194
+ </span>
195
+
196
+
197
+
198
+
199
+ <span class="note title readonly">readonly</span>
200
+
201
+
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+ <span class="summary_desc"><div class='inline'>
210
+ <p>Returns the value of attribute nombre.</p>
211
+ </div></span>
212
+
213
+ </li>
214
+
215
+
216
+ <li class="public ">
217
+ <span class="summary_signature">
218
+
219
+ <a href="#prot-instance_method" title="#prot (instance method)">#<strong>prot</strong> &#x21d2; Object </a>
220
+
221
+
222
+
223
+ </span>
224
+
225
+
226
+
227
+
228
+ <span class="note title readonly">readonly</span>
229
+
230
+
231
+
232
+
233
+
234
+
235
+
236
+
237
+
238
+ <span class="summary_desc"><div class='inline'>
239
+ <p>Returns the value of attribute prot.</p>
240
+ </div></span>
241
+
242
+ </li>
243
+
244
+
245
+ </ul>
246
+
247
+
248
+
249
+
250
+
251
+ <h2>
252
+ Instance Method Summary
253
+ <small><a href="#" class="summary_toggle">collapse</a></small>
254
+ </h2>
255
+
256
+ <ul class="summary">
257
+
258
+ <li class="public ">
259
+ <span class="summary_signature">
260
+
261
+ <a href="#<=>-instance_method" title="#&lt;=&gt; (instance method)">#<strong>&lt;=&gt;</strong>(other) &#x21d2; Object </a>
262
+
263
+
264
+
265
+ </span>
266
+
267
+
268
+
269
+
270
+
271
+
272
+
273
+
274
+
275
+ <span class="summary_desc"><div class='inline'>
276
+ <p>Se utiliza para el mixin Comparable.</p>
277
+ </div></span>
278
+
279
+ </li>
280
+
281
+
282
+ <li class="public ">
283
+ <span class="summary_signature">
284
+
285
+ <a href="#gluc_kcal-instance_method" title="#gluc_kcal (instance method)">#<strong>gluc_kcal</strong> &#x21d2; Object </a>
286
+
287
+
288
+
289
+ </span>
290
+
291
+
292
+
293
+
294
+
295
+
296
+
297
+
298
+
299
+ <span class="summary_desc"><div class='inline'>
300
+ <p>Valor energético del alimento por sus glúcidos.</p>
301
+ </div></span>
302
+
303
+ </li>
304
+
305
+
306
+ <li class="public ">
307
+ <span class="summary_signature">
308
+
309
+ <a href="#gras_kcal-instance_method" title="#gras_kcal (instance method)">#<strong>gras_kcal</strong> &#x21d2; Object </a>
310
+
311
+
312
+
313
+ </span>
314
+
315
+
316
+
317
+
318
+
319
+
320
+
321
+
322
+
323
+ <span class="summary_desc"><div class='inline'>
324
+ <p>Valor energético del alimento por sus grasas.</p>
325
+ </div></span>
326
+
327
+ </li>
328
+
329
+
330
+ <li class="public ">
331
+ <span class="summary_signature">
332
+
333
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(n, proteinas, glucidos, grasas) &#x21d2; Alimento </a>
334
+
335
+
336
+
337
+ </span>
338
+
339
+
340
+ <span class="note title constructor">constructor</span>
341
+
342
+
343
+
344
+
345
+
346
+
347
+
348
+
349
+ <span class="summary_desc"><div class='inline'>
350
+ <p>Asigna el nombre y los valores de sus macroelementos.</p>
351
+ </div></span>
352
+
353
+ </li>
354
+
355
+
356
+ <li class="public ">
357
+ <span class="summary_signature">
358
+
359
+ <a href="#kcal-instance_method" title="#kcal (instance method)">#<strong>kcal</strong> &#x21d2; Object </a>
360
+
361
+
362
+
363
+ </span>
364
+
365
+
366
+
367
+
368
+
369
+
370
+
371
+
372
+
373
+ <span class="summary_desc"><div class='inline'>
374
+ <p>Valor energético del alimento.</p>
375
+ </div></span>
376
+
377
+ </li>
378
+
379
+
380
+ <li class="public ">
381
+ <span class="summary_signature">
382
+
383
+ <a href="#prot_kcal-instance_method" title="#prot_kcal (instance method)">#<strong>prot_kcal</strong> &#x21d2; Object </a>
384
+
385
+
386
+
387
+ </span>
388
+
389
+
390
+
391
+
392
+
393
+
394
+
395
+
396
+
397
+ <span class="summary_desc"><div class='inline'>
398
+ <p>Valor energético del alimento por sus proteínas.</p>
399
+ </div></span>
400
+
401
+ </li>
402
+
403
+
404
+ <li class="public ">
405
+ <span class="summary_signature">
406
+
407
+ <a href="#to_s-instance_method" title="#to_s (instance method)">#<strong>to_s</strong> &#x21d2; Object </a>
408
+
409
+
410
+
411
+ </span>
412
+
413
+
414
+
415
+
416
+
417
+
418
+
419
+
420
+
421
+ <span class="summary_desc"><div class='inline'>
422
+ <p>Devuelve un string formateado con la información del alimento.</p>
423
+ </div></span>
424
+
425
+ </li>
426
+
427
+
428
+ </ul>
429
+
430
+
431
+
432
+ <div id="constructor_details" class="method_details_list">
433
+ <h2>Constructor Details</h2>
434
+
435
+ <div class="method_details first">
436
+ <h3 class="signature first" id="initialize-instance_method">
437
+
438
+ #<strong>initialize</strong>(n, proteinas, glucidos, grasas) &#x21d2; <tt><span class='object_link'><a href="" title="Alimento::Alimento (class)">Alimento</a></span></tt>
439
+
440
+
441
+
442
+
443
+
444
+ </h3><div class="docstring">
445
+ <div class="discussion">
446
+
447
+ <p>Asigna el nombre y los valores de sus macroelementos.</p>
448
+
449
+
450
+ </div>
451
+ </div>
452
+ <div class="tags">
453
+
454
+
455
+ </div><table class="source_code">
456
+ <tr>
457
+ <td>
458
+ <pre class="lines">
459
+
460
+
461
+ 17
462
+ 18
463
+ 19
464
+ 20
465
+ 21
466
+ 22</pre>
467
+ </td>
468
+ <td>
469
+ <pre class="code"><span class="info file"># File 'lib/alimento/alimento.rb', line 17</span>
470
+
471
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span> <span class='lparen'>(</span><span class='id identifier rubyid_n'>n</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_grasas'>grasas</span><span class='rparen'>)</span>
472
+ <span class='ivar'>@nombre</span> <span class='op'>=</span> <span class='id identifier rubyid_n'>n</span>
473
+ <span class='ivar'>@prot</span> <span class='op'>=</span> <span class='id identifier rubyid_proteinas'>proteinas</span>
474
+ <span class='ivar'>@gluc</span> <span class='op'>=</span> <span class='id identifier rubyid_glucidos'>glucidos</span>
475
+ <span class='ivar'>@gras</span> <span class='op'>=</span> <span class='id identifier rubyid_grasas'>grasas</span>
476
+ <span class='kw'>end</span></pre>
477
+ </td>
478
+ </tr>
479
+ </table>
480
+ </div>
481
+
482
+ </div>
483
+
484
+ <div id="instance_attr_details" class="attr_details">
485
+ <h2>Instance Attribute Details</h2>
486
+
487
+
488
+ <span id=""></span>
489
+ <div class="method_details first">
490
+ <h3 class="signature first" id="gluc-instance_method">
491
+
492
+ #<strong>gluc</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
493
+
494
+
495
+
496
+
497
+
498
+ </h3><div class="docstring">
499
+ <div class="discussion">
500
+
501
+ <p>Returns the value of attribute gluc</p>
502
+
503
+
504
+ </div>
505
+ </div>
506
+ <div class="tags">
507
+
508
+
509
+ </div><table class="source_code">
510
+ <tr>
511
+ <td>
512
+ <pre class="lines">
513
+
514
+
515
+ 14
516
+ 15
517
+ 16</pre>
518
+ </td>
519
+ <td>
520
+ <pre class="code"><span class="info file"># File 'lib/alimento/alimento.rb', line 14</span>
521
+
522
+ <span class='kw'>def</span> <span class='id identifier rubyid_gluc'>gluc</span>
523
+ <span class='ivar'>@gluc</span>
524
+ <span class='kw'>end</span></pre>
525
+ </td>
526
+ </tr>
527
+ </table>
528
+ </div>
529
+
530
+
531
+ <span id=""></span>
532
+ <div class="method_details ">
533
+ <h3 class="signature " id="gras-instance_method">
534
+
535
+ #<strong>gras</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
536
+
537
+
538
+
539
+
540
+
541
+ </h3><div class="docstring">
542
+ <div class="discussion">
543
+
544
+ <p>Returns the value of attribute gras</p>
545
+
546
+
547
+ </div>
548
+ </div>
549
+ <div class="tags">
550
+
551
+
552
+ </div><table class="source_code">
553
+ <tr>
554
+ <td>
555
+ <pre class="lines">
556
+
557
+
558
+ 14
559
+ 15
560
+ 16</pre>
561
+ </td>
562
+ <td>
563
+ <pre class="code"><span class="info file"># File 'lib/alimento/alimento.rb', line 14</span>
564
+
565
+ <span class='kw'>def</span> <span class='id identifier rubyid_gras'>gras</span>
566
+ <span class='ivar'>@gras</span>
567
+ <span class='kw'>end</span></pre>
568
+ </td>
569
+ </tr>
570
+ </table>
571
+ </div>
572
+
573
+
574
+ <span id=""></span>
575
+ <div class="method_details ">
576
+ <h3 class="signature " id="nombre-instance_method">
577
+
578
+ #<strong>nombre</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
579
+
580
+
581
+
582
+
583
+
584
+ </h3><div class="docstring">
585
+ <div class="discussion">
586
+
587
+ <p>Returns the value of attribute nombre</p>
588
+
589
+
590
+ </div>
591
+ </div>
592
+ <div class="tags">
593
+
594
+
595
+ </div><table class="source_code">
596
+ <tr>
597
+ <td>
598
+ <pre class="lines">
599
+
600
+
601
+ 14
602
+ 15
603
+ 16</pre>
604
+ </td>
605
+ <td>
606
+ <pre class="code"><span class="info file"># File 'lib/alimento/alimento.rb', line 14</span>
607
+
608
+ <span class='kw'>def</span> <span class='id identifier rubyid_nombre'>nombre</span>
609
+ <span class='ivar'>@nombre</span>
610
+ <span class='kw'>end</span></pre>
611
+ </td>
612
+ </tr>
613
+ </table>
614
+ </div>
615
+
616
+
617
+ <span id=""></span>
618
+ <div class="method_details ">
619
+ <h3 class="signature " id="prot-instance_method">
620
+
621
+ #<strong>prot</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
622
+
623
+
624
+
625
+
626
+
627
+ </h3><div class="docstring">
628
+ <div class="discussion">
629
+
630
+ <p>Returns the value of attribute prot</p>
631
+
632
+
633
+ </div>
634
+ </div>
635
+ <div class="tags">
636
+
637
+
638
+ </div><table class="source_code">
639
+ <tr>
640
+ <td>
641
+ <pre class="lines">
642
+
643
+
644
+ 14
645
+ 15
646
+ 16</pre>
647
+ </td>
648
+ <td>
649
+ <pre class="code"><span class="info file"># File 'lib/alimento/alimento.rb', line 14</span>
650
+
651
+ <span class='kw'>def</span> <span class='id identifier rubyid_prot'>prot</span>
652
+ <span class='ivar'>@prot</span>
653
+ <span class='kw'>end</span></pre>
654
+ </td>
655
+ </tr>
656
+ </table>
657
+ </div>
658
+
659
+ </div>
660
+
661
+
662
+ <div id="instance_method_details" class="method_details_list">
663
+ <h2>Instance Method Details</h2>
664
+
665
+
666
+ <div class="method_details first">
667
+ <h3 class="signature first" id="<=>-instance_method">
668
+
669
+ #<strong>&lt;=&gt;</strong>(other) &#x21d2; <tt>Object</tt>
670
+
671
+
672
+
673
+
674
+
675
+ </h3><div class="docstring">
676
+ <div class="discussion">
677
+
678
+ <p>Se utiliza para el mixin Comparable. Se toma como valor para la comparación
679
+ del valor calórico.</p>
680
+
681
+
682
+ </div>
683
+ </div>
684
+ <div class="tags">
685
+
686
+
687
+ </div><table class="source_code">
688
+ <tr>
689
+ <td>
690
+ <pre class="lines">
691
+
692
+
693
+ 37
694
+ 38
695
+ 39
696
+ 40</pre>
697
+ </td>
698
+ <td>
699
+ <pre class="code"><span class="info file"># File 'lib/alimento/alimento.rb', line 37</span>
700
+
701
+ <span class='kw'>def</span> <span class='op'>&lt;=&gt;</span><span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='rparen'>)</span>
702
+ <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>unless</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_kind_of?'>kind_of?</span><span class='const'>Alimento</span>
703
+ <span class='id identifier rubyid_kcal'>kcal</span> <span class='op'>&lt;=&gt;</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_kcal'>kcal</span>
704
+ <span class='kw'>end</span></pre>
705
+ </td>
706
+ </tr>
707
+ </table>
708
+ </div>
709
+
710
+ <div class="method_details ">
711
+ <h3 class="signature " id="gluc_kcal-instance_method">
712
+
713
+ #<strong>gluc_kcal</strong> &#x21d2; <tt>Object</tt>
714
+
715
+
716
+
717
+
718
+
719
+ </h3><div class="docstring">
720
+ <div class="discussion">
721
+
722
+ <p>Valor energético del alimento por sus glúcidos.</p>
723
+
724
+
725
+ </div>
726
+ </div>
727
+ <div class="tags">
728
+
729
+
730
+ </div><table class="source_code">
731
+ <tr>
732
+ <td>
733
+ <pre class="lines">
734
+
735
+
736
+ 47
737
+ 48
738
+ 49</pre>
739
+ </td>
740
+ <td>
741
+ <pre class="code"><span class="info file"># File 'lib/alimento/alimento.rb', line 47</span>
742
+
743
+ <span class='kw'>def</span> <span class='id identifier rubyid_gluc_kcal'>gluc_kcal</span>
744
+ <span class='ivar'>@gluc</span><span class='op'>*</span><span class='int'>4</span>
745
+ <span class='kw'>end</span></pre>
746
+ </td>
747
+ </tr>
748
+ </table>
749
+ </div>
750
+
751
+ <div class="method_details ">
752
+ <h3 class="signature " id="gras_kcal-instance_method">
753
+
754
+ #<strong>gras_kcal</strong> &#x21d2; <tt>Object</tt>
755
+
756
+
757
+
758
+
759
+
760
+ </h3><div class="docstring">
761
+ <div class="discussion">
762
+
763
+ <p>Valor energético del alimento por sus grasas.</p>
764
+
765
+
766
+ </div>
767
+ </div>
768
+ <div class="tags">
769
+
770
+
771
+ </div><table class="source_code">
772
+ <tr>
773
+ <td>
774
+ <pre class="lines">
775
+
776
+
777
+ 51
778
+ 52
779
+ 53</pre>
780
+ </td>
781
+ <td>
782
+ <pre class="code"><span class="info file"># File 'lib/alimento/alimento.rb', line 51</span>
783
+
784
+ <span class='kw'>def</span> <span class='id identifier rubyid_gras_kcal'>gras_kcal</span>
785
+ <span class='ivar'>@gras</span><span class='op'>*</span><span class='int'>9</span>
786
+ <span class='kw'>end</span></pre>
787
+ </td>
788
+ </tr>
789
+ </table>
790
+ </div>
791
+
792
+ <div class="method_details ">
793
+ <h3 class="signature " id="kcal-instance_method">
794
+
795
+ #<strong>kcal</strong> &#x21d2; <tt>Object</tt>
796
+
797
+
798
+
799
+
800
+
801
+ </h3><div class="docstring">
802
+ <div class="discussion">
803
+
804
+ <p>Valor energético del alimento.</p>
805
+
806
+
807
+ </div>
808
+ </div>
809
+ <div class="tags">
810
+
811
+
812
+ </div><table class="source_code">
813
+ <tr>
814
+ <td>
815
+ <pre class="lines">
816
+
817
+
818
+ 30
819
+ 31
820
+ 32</pre>
821
+ </td>
822
+ <td>
823
+ <pre class="code"><span class="info file"># File 'lib/alimento/alimento.rb', line 30</span>
824
+
825
+ <span class='kw'>def</span> <span class='id identifier rubyid_kcal'>kcal</span>
826
+ <span class='id identifier rubyid_prot_kcal'>prot_kcal</span> <span class='op'>+</span> <span class='id identifier rubyid_gluc_kcal'>gluc_kcal</span> <span class='op'>+</span> <span class='id identifier rubyid_gras_kcal'>gras_kcal</span>
827
+ <span class='kw'>end</span></pre>
828
+ </td>
829
+ </tr>
830
+ </table>
831
+ </div>
832
+
833
+ <div class="method_details ">
834
+ <h3 class="signature " id="prot_kcal-instance_method">
835
+
836
+ #<strong>prot_kcal</strong> &#x21d2; <tt>Object</tt>
837
+
838
+
839
+
840
+
841
+
842
+ </h3><div class="docstring">
843
+ <div class="discussion">
844
+
845
+ <p>Valor energético del alimento por sus proteínas.</p>
846
+
847
+
848
+ </div>
849
+ </div>
850
+ <div class="tags">
851
+
852
+
853
+ </div><table class="source_code">
854
+ <tr>
855
+ <td>
856
+ <pre class="lines">
857
+
858
+
859
+ 43
860
+ 44
861
+ 45</pre>
862
+ </td>
863
+ <td>
864
+ <pre class="code"><span class="info file"># File 'lib/alimento/alimento.rb', line 43</span>
865
+
866
+ <span class='kw'>def</span> <span class='id identifier rubyid_prot_kcal'>prot_kcal</span>
867
+ <span class='ivar'>@prot</span><span class='op'>*</span><span class='int'>4</span>
868
+ <span class='kw'>end</span></pre>
869
+ </td>
870
+ </tr>
871
+ </table>
872
+ </div>
873
+
874
+ <div class="method_details ">
875
+ <h3 class="signature " id="to_s-instance_method">
876
+
877
+ #<strong>to_s</strong> &#x21d2; <tt>Object</tt>
878
+
879
+
880
+
881
+
882
+
883
+ </h3><div class="docstring">
884
+ <div class="discussion">
885
+
886
+ <p>Devuelve un string formateado con la información del alimento.</p>
887
+
888
+
889
+ </div>
890
+ </div>
891
+ <div class="tags">
892
+
893
+
894
+ </div><table class="source_code">
895
+ <tr>
896
+ <td>
897
+ <pre class="lines">
898
+
899
+
900
+ 25
901
+ 26
902
+ 27</pre>
903
+ </td>
904
+ <td>
905
+ <pre class="code"><span class="info file"># File 'lib/alimento/alimento.rb', line 25</span>
906
+
907
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_s'>to_s</span>
908
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='ivar'>@nombre</span><span class='embexpr_end'>}</span><span class='tstring_content'> -&gt; P: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@prot</span><span class='embexpr_end'>}</span><span class='tstring_content'>g | Gl: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@gluc</span><span class='embexpr_end'>}</span><span class='tstring_content'>g | Gr: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@gras</span><span class='embexpr_end'>}</span><span class='tstring_content'>g</span><span class='tstring_end'>&quot;</span></span>
909
+ <span class='kw'>end</span></pre>
910
+ </td>
911
+ </tr>
912
+ </table>
913
+ </div>
914
+
915
+ </div>
916
+
917
+ </div>
918
+
919
+ <div id="footer">
920
+ Generated on Fri Nov 17 00:34:35 2017 by
921
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
922
+ 0.9.9 (ruby-2.3.0).
923
+ </div>
924
+
925
+ </div>
926
+ </body>
927
+ </html>