pract 0.1.0

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: 1441e3a72607615915ec0f6fcc3f810403240772
4
+ data.tar.gz: d3a0a2ae225a429151f7cde386109ec8e701c7d2
5
+ SHA512:
6
+ metadata.gz: d0885eb79d73555427d8799aac9bbb62d689c0938ef061157ac095a52e56c270ecde09e9ff72b424cc37987890389d26dd3bc6e44041563f07e58db4616d72ed
7
+ data.tar.gz: 9153032cb5a38486be14bffb843b7a434d13d9aafa0496e8b35fdba97d0b4b6e987737fa419aa4d25ae991407827608001c7068718f4d69877b804c3b134169c
data/.coveralls.yml ADDED
@@ -0,0 +1,2 @@
1
+ service_name: travis-ci
2
+ repo_token: adsG7UPxRwNAL7hVk5ikFX3JCpjtF00Sw
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 1.9.3
5
+
6
+ before_install: gem install bundler -v 1.15.4
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at alu0100948387@ull.edu.es. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/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 pract.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/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Adrián Prieto
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,43 @@
1
+ # Pract
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/pract`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'pract'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install pract
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/pract. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
40
+
41
+ ## Code of Conduct
42
+
43
+ Everyone interacting in the Pract project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/pract/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,29 @@
1
+ require "rake/testtask"
2
+ require "bundler/gem_tasks"
3
+
4
+ task :default => :plate
5
+
6
+ desc "Ejecutar pruebas de la prueba Alimento"
7
+ task :sort do
8
+ sh "rspec -I. spec/sort_spec.rb"
9
+ end
10
+
11
+ desc "Ejecutar pruebas de la prueba Alimento"
12
+ task :alimento do
13
+ sh "rspec -I. spec/pract_spec.rb"
14
+ end
15
+
16
+ desc "Ejecutar pruebas de la prueba Nodo"
17
+ task :nodo do
18
+ sh "rspec -I. spec/nodo_spec.rb"
19
+ end
20
+
21
+ desc "Ejecutar pruebas de la prueba Grupo"
22
+ task :group do
23
+ sh "rspec -I. spec/group_spec.rb"
24
+ end
25
+
26
+ desc "Ejecutar pruebas de la prueba Plato"
27
+ task :plate do
28
+ sh "rspec -I. spec/plate_spec.rb"
29
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "pract"
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,1145 @@
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
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>Class: 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</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/pract.rb</dd>
103
+ </dl>
104
+
105
+ </div>
106
+
107
+ <div id="subclasses">
108
+ <h2>Direct Known Subclasses</h2>
109
+ <p class="children"><span class='object_link'><a href="Grupo.html" title="Grupo (class)">Grupo</a></span></p>
110
+ </div>
111
+
112
+
113
+
114
+
115
+ <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
116
+ <ul class="summary">
117
+
118
+ <li class="public ">
119
+ <span class="summary_signature">
120
+
121
+ <a href="#glucid-instance_method" title="#glucid (instance method)">#<strong>glucid</strong> &#x21d2; Object </a>
122
+
123
+
124
+
125
+ </span>
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+ <span class="summary_desc"><div class='inline'>
139
+ <p>Returns the value of attribute glucid.</p>
140
+ </div></span>
141
+
142
+ </li>
143
+
144
+
145
+ <li class="public ">
146
+ <span class="summary_signature">
147
+
148
+ <a href="#lipid-instance_method" title="#lipid (instance method)">#<strong>lipid</strong> &#x21d2; Object </a>
149
+
150
+
151
+
152
+ </span>
153
+
154
+
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+ <span class="summary_desc"><div class='inline'>
166
+ <p>Returns the value of attribute lipid.</p>
167
+ </div></span>
168
+
169
+ </li>
170
+
171
+
172
+ <li class="public ">
173
+ <span class="summary_signature">
174
+
175
+ <a href="#name-instance_method" title="#name (instance method)">#<strong>name</strong> &#x21d2; Object </a>
176
+
177
+
178
+
179
+ </span>
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+ <span class="summary_desc"><div class='inline'>
193
+ <p>Returns the value of attribute name.</p>
194
+ </div></span>
195
+
196
+ </li>
197
+
198
+
199
+ <li class="public ">
200
+ <span class="summary_signature">
201
+
202
+ <a href="#protein-instance_method" title="#protein (instance method)">#<strong>protein</strong> &#x21d2; Object </a>
203
+
204
+
205
+
206
+ </span>
207
+
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+ <span class="summary_desc"><div class='inline'>
220
+ <p>Returns the value of attribute protein.</p>
221
+ </div></span>
222
+
223
+ </li>
224
+
225
+
226
+ </ul>
227
+
228
+
229
+
230
+
231
+
232
+ <h2>
233
+ Instance Method Summary
234
+ <small><a href="#" class="summary_toggle">collapse</a></small>
235
+ </h2>
236
+
237
+ <ul class="summary">
238
+
239
+ <li class="public ">
240
+ <span class="summary_signature">
241
+
242
+ <a href="#<=>-instance_method" title="#&lt;=&gt; (instance method)">#<strong>&lt;=&gt;</strong>(other) &#x21d2; Object </a>
243
+
244
+
245
+
246
+ </span>
247
+
248
+
249
+
250
+
251
+
252
+
253
+
254
+
255
+
256
+ <span class="summary_desc"><div class='inline'>
257
+ <p>Make it comparable.</p>
258
+ </div></span>
259
+
260
+ </li>
261
+
262
+
263
+ <li class="public ">
264
+ <span class="summary_signature">
265
+
266
+ <a href="#==-instance_method" title="#== (instance method)">#<strong>==</strong>(other) &#x21d2; Object </a>
267
+
268
+
269
+
270
+ </span>
271
+
272
+
273
+
274
+
275
+
276
+
277
+
278
+
279
+
280
+ <span class="summary_desc"><div class='inline'>
281
+ <p>Define also the function == in comparable.</p>
282
+ </div></span>
283
+
284
+ </li>
285
+
286
+
287
+ <li class="public ">
288
+ <span class="summary_signature">
289
+
290
+ <a href="#energy-instance_method" title="#energy (instance method)">#<strong>energy</strong> &#x21d2; Object </a>
291
+
292
+
293
+
294
+ </span>
295
+
296
+
297
+
298
+
299
+
300
+
301
+
302
+
303
+
304
+ <span class="summary_desc"><div class='inline'>
305
+ <p>The total energy of food.</p>
306
+ </div></span>
307
+
308
+ </li>
309
+
310
+
311
+ <li class="public ">
312
+ <span class="summary_signature">
313
+
314
+ <a href="#glucid_energy-instance_method" title="#glucid_energy (instance method)">#<strong>glucid_energy</strong> &#x21d2; Object </a>
315
+
316
+
317
+
318
+ </span>
319
+
320
+
321
+
322
+
323
+
324
+
325
+
326
+
327
+
328
+ <span class="summary_desc"><div class='inline'>
329
+ <p>The energy provided by glucids.</p>
330
+ </div></span>
331
+
332
+ </li>
333
+
334
+
335
+ <li class="public ">
336
+ <span class="summary_signature">
337
+
338
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(name, protein, glucid, lipid) &#x21d2; Alimento </a>
339
+
340
+
341
+
342
+ </span>
343
+
344
+
345
+ <span class="note title constructor">constructor</span>
346
+
347
+
348
+
349
+
350
+
351
+
352
+
353
+
354
+ <span class="summary_desc"><div class='inline'>
355
+ <p>Constructor @ param name of food [String] and the attributes: protein,
356
+ glucid, lipid.</p>
357
+ </div></span>
358
+
359
+ </li>
360
+
361
+
362
+ <li class="public ">
363
+ <span class="summary_signature">
364
+
365
+ <a href="#lipid_energy-instance_method" title="#lipid_energy (instance method)">#<strong>lipid_energy</strong> &#x21d2; Object </a>
366
+
367
+
368
+
369
+ </span>
370
+
371
+
372
+
373
+
374
+
375
+
376
+
377
+
378
+
379
+ <span class="summary_desc"><div class='inline'>
380
+ <p>The energy provided by lipids.</p>
381
+ </div></span>
382
+
383
+ </li>
384
+
385
+
386
+ <li class="public ">
387
+ <span class="summary_signature">
388
+
389
+ <a href="#protein_energy-instance_method" title="#protein_energy (instance method)">#<strong>protein_energy</strong> &#x21d2; Object </a>
390
+
391
+
392
+
393
+ </span>
394
+
395
+
396
+
397
+
398
+
399
+
400
+
401
+
402
+
403
+ <span class="summary_desc"><div class='inline'>
404
+ <p>The energy provided by proteins.</p>
405
+ </div></span>
406
+
407
+ </li>
408
+
409
+
410
+ <li class="public ">
411
+ <span class="summary_signature">
412
+
413
+ <a href="#show_energy-instance_method" title="#show_energy (instance method)">#<strong>show_energy</strong> &#x21d2; Object </a>
414
+
415
+
416
+
417
+ </span>
418
+
419
+
420
+
421
+
422
+
423
+
424
+
425
+
426
+
427
+ <span class="summary_desc"><div class='inline'>
428
+ <p>Only name and total energy.</p>
429
+ </div></span>
430
+
431
+ </li>
432
+
433
+
434
+ <li class="public ">
435
+ <span class="summary_signature">
436
+
437
+ <a href="#to_s-instance_method" title="#to_s (instance method)">#<strong>to_s</strong> &#x21d2; Object </a>
438
+
439
+
440
+
441
+ </span>
442
+
443
+
444
+
445
+
446
+
447
+
448
+
449
+
450
+
451
+ <span class="summary_desc"><div class='inline'>
452
+ <p>The format showed by puts.</p>
453
+ </div></span>
454
+
455
+ </li>
456
+
457
+
458
+ </ul>
459
+
460
+
461
+
462
+ <div id="constructor_details" class="method_details_list">
463
+ <h2>Constructor Details</h2>
464
+
465
+ <div class="method_details first">
466
+ <h3 class="signature first" id="initialize-instance_method">
467
+
468
+ #<strong>initialize</strong>(name, protein, glucid, lipid) &#x21d2; <tt><span class='object_link'><a href="" title="Alimento (class)">Alimento</a></span></tt>
469
+
470
+
471
+
472
+
473
+
474
+ </h3><div class="docstring">
475
+ <div class="discussion">
476
+
477
+ <p>Constructor @ param name of food [String] and the attributes: protein,
478
+ glucid, lipid</p>
479
+
480
+
481
+ </div>
482
+ </div>
483
+ <div class="tags">
484
+
485
+
486
+ </div><table class="source_code">
487
+ <tr>
488
+ <td>
489
+ <pre class="lines">
490
+
491
+
492
+ 8
493
+ 9
494
+ 10
495
+ 11
496
+ 12
497
+ 13</pre>
498
+ </td>
499
+ <td>
500
+ <pre class="code"><span class="info file"># File 'lib/pract.rb', line 8</span>
501
+
502
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span> <span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_protein'>protein</span><span class='comma'>,</span> <span class='id identifier rubyid_glucid'>glucid</span><span class='comma'>,</span> <span class='id identifier rubyid_lipid'>lipid</span><span class='rparen'>)</span>
503
+ <span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span>
504
+ <span class='ivar'>@protein</span> <span class='op'>=</span> <span class='id identifier rubyid_protein'>protein</span>
505
+ <span class='ivar'>@glucid</span> <span class='op'>=</span> <span class='id identifier rubyid_glucid'>glucid</span>
506
+ <span class='ivar'>@lipid</span> <span class='op'>=</span> <span class='id identifier rubyid_lipid'>lipid</span>
507
+ <span class='kw'>end</span></pre>
508
+ </td>
509
+ </tr>
510
+ </table>
511
+ </div>
512
+
513
+ </div>
514
+
515
+ <div id="instance_attr_details" class="attr_details">
516
+ <h2>Instance Attribute Details</h2>
517
+
518
+
519
+ <span id="glucid=-instance_method"></span>
520
+ <div class="method_details first">
521
+ <h3 class="signature first" id="glucid-instance_method">
522
+
523
+ #<strong>glucid</strong> &#x21d2; <tt>Object</tt>
524
+
525
+
526
+
527
+
528
+
529
+ </h3><div class="docstring">
530
+ <div class="discussion">
531
+
532
+ <p>Returns the value of attribute glucid</p>
533
+
534
+
535
+ </div>
536
+ </div>
537
+ <div class="tags">
538
+
539
+
540
+ </div><table class="source_code">
541
+ <tr>
542
+ <td>
543
+ <pre class="lines">
544
+
545
+
546
+ 4
547
+ 5
548
+ 6</pre>
549
+ </td>
550
+ <td>
551
+ <pre class="code"><span class="info file"># File 'lib/pract.rb', line 4</span>
552
+
553
+ <span class='kw'>def</span> <span class='id identifier rubyid_glucid'>glucid</span>
554
+ <span class='ivar'>@glucid</span>
555
+ <span class='kw'>end</span></pre>
556
+ </td>
557
+ </tr>
558
+ </table>
559
+ </div>
560
+
561
+
562
+ <span id="lipid=-instance_method"></span>
563
+ <div class="method_details ">
564
+ <h3 class="signature " id="lipid-instance_method">
565
+
566
+ #<strong>lipid</strong> &#x21d2; <tt>Object</tt>
567
+
568
+
569
+
570
+
571
+
572
+ </h3><div class="docstring">
573
+ <div class="discussion">
574
+
575
+ <p>Returns the value of attribute lipid</p>
576
+
577
+
578
+ </div>
579
+ </div>
580
+ <div class="tags">
581
+
582
+
583
+ </div><table class="source_code">
584
+ <tr>
585
+ <td>
586
+ <pre class="lines">
587
+
588
+
589
+ 4
590
+ 5
591
+ 6</pre>
592
+ </td>
593
+ <td>
594
+ <pre class="code"><span class="info file"># File 'lib/pract.rb', line 4</span>
595
+
596
+ <span class='kw'>def</span> <span class='id identifier rubyid_lipid'>lipid</span>
597
+ <span class='ivar'>@lipid</span>
598
+ <span class='kw'>end</span></pre>
599
+ </td>
600
+ </tr>
601
+ </table>
602
+ </div>
603
+
604
+
605
+ <span id="name=-instance_method"></span>
606
+ <div class="method_details ">
607
+ <h3 class="signature " id="name-instance_method">
608
+
609
+ #<strong>name</strong> &#x21d2; <tt>Object</tt>
610
+
611
+
612
+
613
+
614
+
615
+ </h3><div class="docstring">
616
+ <div class="discussion">
617
+
618
+ <p>Returns the value of attribute name</p>
619
+
620
+
621
+ </div>
622
+ </div>
623
+ <div class="tags">
624
+
625
+
626
+ </div><table class="source_code">
627
+ <tr>
628
+ <td>
629
+ <pre class="lines">
630
+
631
+
632
+ 4
633
+ 5
634
+ 6</pre>
635
+ </td>
636
+ <td>
637
+ <pre class="code"><span class="info file"># File 'lib/pract.rb', line 4</span>
638
+
639
+ <span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span>
640
+ <span class='ivar'>@name</span>
641
+ <span class='kw'>end</span></pre>
642
+ </td>
643
+ </tr>
644
+ </table>
645
+ </div>
646
+
647
+
648
+ <span id="protein=-instance_method"></span>
649
+ <div class="method_details ">
650
+ <h3 class="signature " id="protein-instance_method">
651
+
652
+ #<strong>protein</strong> &#x21d2; <tt>Object</tt>
653
+
654
+
655
+
656
+
657
+
658
+ </h3><div class="docstring">
659
+ <div class="discussion">
660
+
661
+ <p>Returns the value of attribute protein</p>
662
+
663
+
664
+ </div>
665
+ </div>
666
+ <div class="tags">
667
+
668
+
669
+ </div><table class="source_code">
670
+ <tr>
671
+ <td>
672
+ <pre class="lines">
673
+
674
+
675
+ 4
676
+ 5
677
+ 6</pre>
678
+ </td>
679
+ <td>
680
+ <pre class="code"><span class="info file"># File 'lib/pract.rb', line 4</span>
681
+
682
+ <span class='kw'>def</span> <span class='id identifier rubyid_protein'>protein</span>
683
+ <span class='ivar'>@protein</span>
684
+ <span class='kw'>end</span></pre>
685
+ </td>
686
+ </tr>
687
+ </table>
688
+ </div>
689
+
690
+ </div>
691
+
692
+
693
+ <div id="instance_method_details" class="method_details_list">
694
+ <h2>Instance Method Details</h2>
695
+
696
+
697
+ <div class="method_details first">
698
+ <h3 class="signature first" id="<=>-instance_method">
699
+
700
+ #<strong>&lt;=&gt;</strong>(other) &#x21d2; <tt>Object</tt>
701
+
702
+
703
+
704
+
705
+
706
+ </h3><div class="docstring">
707
+ <div class="discussion">
708
+
709
+ <p>Make it comparable</p>
710
+
711
+
712
+ </div>
713
+ </div>
714
+ <div class="tags">
715
+
716
+
717
+ </div><table class="source_code">
718
+ <tr>
719
+ <td>
720
+ <pre class="lines">
721
+
722
+
723
+ 39
724
+ 40
725
+ 41</pre>
726
+ </td>
727
+ <td>
728
+ <pre class="code"><span class="info file"># File 'lib/pract.rb', line 39</span>
729
+
730
+ <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>
731
+ <span class='kw'>return</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_energy'>energy</span> <span class='op'>&lt;=&gt;</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_energy'>energy</span>
732
+ <span class='kw'>end</span></pre>
733
+ </td>
734
+ </tr>
735
+ </table>
736
+ </div>
737
+
738
+ <div class="method_details ">
739
+ <h3 class="signature " id="==-instance_method">
740
+
741
+ #<strong>==</strong>(other) &#x21d2; <tt>Object</tt>
742
+
743
+
744
+
745
+
746
+
747
+ </h3><div class="docstring">
748
+ <div class="discussion">
749
+
750
+ <p>Define also the function == in comparable</p>
751
+
752
+
753
+ </div>
754
+ </div>
755
+ <div class="tags">
756
+
757
+
758
+ </div><table class="source_code">
759
+ <tr>
760
+ <td>
761
+ <pre class="lines">
762
+
763
+
764
+ 43
765
+ 44
766
+ 45</pre>
767
+ </td>
768
+ <td>
769
+ <pre class="code"><span class="info file"># File 'lib/pract.rb', line 43</span>
770
+
771
+ <span class='kw'>def</span> <span class='op'>==</span> <span class='lparen'>(</span><span class='id identifier rubyid_other'>other</span><span class='rparen'>)</span>
772
+ <span class='kw'>return</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_energy'>energy</span> <span class='op'>==</span> <span class='id identifier rubyid_other'>other</span><span class='period'>.</span><span class='id identifier rubyid_energy'>energy</span>
773
+ <span class='kw'>end</span></pre>
774
+ </td>
775
+ </tr>
776
+ </table>
777
+ </div>
778
+
779
+ <div class="method_details ">
780
+ <h3 class="signature " id="energy-instance_method">
781
+
782
+ #<strong>energy</strong> &#x21d2; <tt>Object</tt>
783
+
784
+
785
+
786
+
787
+
788
+ </h3><div class="docstring">
789
+ <div class="discussion">
790
+
791
+ <p>Returns the total energy of food</p>
792
+
793
+
794
+ </div>
795
+ </div>
796
+ <div class="tags">
797
+
798
+ <p class="tag_title">Returns:</p>
799
+ <ul class="return">
800
+
801
+ <li>
802
+
803
+
804
+ <span class='type'></span>
805
+
806
+
807
+
808
+
809
+ <div class='inline'>
810
+ <p>the total energy of food</p>
811
+ </div>
812
+
813
+ </li>
814
+
815
+ </ul>
816
+
817
+ </div><table class="source_code">
818
+ <tr>
819
+ <td>
820
+ <pre class="lines">
821
+
822
+
823
+ 27
824
+ 28
825
+ 29</pre>
826
+ </td>
827
+ <td>
828
+ <pre class="code"><span class="info file"># File 'lib/pract.rb', line 27</span>
829
+
830
+ <span class='kw'>def</span> <span class='id identifier rubyid_energy'>energy</span>
831
+ <span class='kw'>return</span> <span class='id identifier rubyid_glucid_energy'>glucid_energy</span> <span class='op'>+</span> <span class='id identifier rubyid_protein_energy'>protein_energy</span> <span class='op'>+</span> <span class='id identifier rubyid_lipid_energy'>lipid_energy</span>
832
+ <span class='kw'>end</span></pre>
833
+ </td>
834
+ </tr>
835
+ </table>
836
+ </div>
837
+
838
+ <div class="method_details ">
839
+ <h3 class="signature " id="glucid_energy-instance_method">
840
+
841
+ #<strong>glucid_energy</strong> &#x21d2; <tt>Object</tt>
842
+
843
+
844
+
845
+
846
+
847
+ </h3><div class="docstring">
848
+ <div class="discussion">
849
+
850
+ <p>Returns the energy provided by glucids</p>
851
+
852
+
853
+ </div>
854
+ </div>
855
+ <div class="tags">
856
+
857
+ <p class="tag_title">Returns:</p>
858
+ <ul class="return">
859
+
860
+ <li>
861
+
862
+
863
+ <span class='type'></span>
864
+
865
+
866
+
867
+
868
+ <div class='inline'>
869
+ <p>the energy provided by glucids</p>
870
+ </div>
871
+
872
+ </li>
873
+
874
+ </ul>
875
+
876
+ </div><table class="source_code">
877
+ <tr>
878
+ <td>
879
+ <pre class="lines">
880
+
881
+
882
+ 19
883
+ 20
884
+ 21</pre>
885
+ </td>
886
+ <td>
887
+ <pre class="code"><span class="info file"># File 'lib/pract.rb', line 19</span>
888
+
889
+ <span class='kw'>def</span> <span class='id identifier rubyid_glucid_energy'>glucid_energy</span>
890
+ <span class='kw'>return</span> <span class='ivar'>@glucid</span> <span class='op'>*</span> <span class='int'>4</span>
891
+ <span class='kw'>end</span></pre>
892
+ </td>
893
+ </tr>
894
+ </table>
895
+ </div>
896
+
897
+ <div class="method_details ">
898
+ <h3 class="signature " id="lipid_energy-instance_method">
899
+
900
+ #<strong>lipid_energy</strong> &#x21d2; <tt>Object</tt>
901
+
902
+
903
+
904
+
905
+
906
+ </h3><div class="docstring">
907
+ <div class="discussion">
908
+
909
+ <p>Returns the energy provided by lipids</p>
910
+
911
+
912
+ </div>
913
+ </div>
914
+ <div class="tags">
915
+
916
+ <p class="tag_title">Returns:</p>
917
+ <ul class="return">
918
+
919
+ <li>
920
+
921
+
922
+ <span class='type'></span>
923
+
924
+
925
+
926
+
927
+ <div class='inline'>
928
+ <p>the energy provided by lipids</p>
929
+ </div>
930
+
931
+ </li>
932
+
933
+ </ul>
934
+
935
+ </div><table class="source_code">
936
+ <tr>
937
+ <td>
938
+ <pre class="lines">
939
+
940
+
941
+ 23
942
+ 24
943
+ 25</pre>
944
+ </td>
945
+ <td>
946
+ <pre class="code"><span class="info file"># File 'lib/pract.rb', line 23</span>
947
+
948
+ <span class='kw'>def</span> <span class='id identifier rubyid_lipid_energy'>lipid_energy</span>
949
+ <span class='kw'>return</span> <span class='ivar'>@lipid</span> <span class='op'>*</span> <span class='int'>9</span>
950
+ <span class='kw'>end</span></pre>
951
+ </td>
952
+ </tr>
953
+ </table>
954
+ </div>
955
+
956
+ <div class="method_details ">
957
+ <h3 class="signature " id="protein_energy-instance_method">
958
+
959
+ #<strong>protein_energy</strong> &#x21d2; <tt>Object</tt>
960
+
961
+
962
+
963
+
964
+
965
+ </h3><div class="docstring">
966
+ <div class="discussion">
967
+
968
+ <p>Returns the energy provided by proteins</p>
969
+
970
+
971
+ </div>
972
+ </div>
973
+ <div class="tags">
974
+
975
+ <p class="tag_title">Returns:</p>
976
+ <ul class="return">
977
+
978
+ <li>
979
+
980
+
981
+ <span class='type'></span>
982
+
983
+
984
+
985
+
986
+ <div class='inline'>
987
+ <p>the energy provided by proteins</p>
988
+ </div>
989
+
990
+ </li>
991
+
992
+ </ul>
993
+
994
+ </div><table class="source_code">
995
+ <tr>
996
+ <td>
997
+ <pre class="lines">
998
+
999
+
1000
+ 15
1001
+ 16
1002
+ 17</pre>
1003
+ </td>
1004
+ <td>
1005
+ <pre class="code"><span class="info file"># File 'lib/pract.rb', line 15</span>
1006
+
1007
+ <span class='kw'>def</span> <span class='id identifier rubyid_protein_energy'>protein_energy</span>
1008
+ <span class='kw'>return</span> <span class='ivar'>@protein</span> <span class='op'>*</span> <span class='int'>4</span>
1009
+ <span class='kw'>end</span></pre>
1010
+ </td>
1011
+ </tr>
1012
+ </table>
1013
+ </div>
1014
+
1015
+ <div class="method_details ">
1016
+ <h3 class="signature " id="show_energy-instance_method">
1017
+
1018
+ #<strong>show_energy</strong> &#x21d2; <tt>Object</tt>
1019
+
1020
+
1021
+
1022
+
1023
+
1024
+ </h3><div class="docstring">
1025
+ <div class="discussion">
1026
+
1027
+ <p>Returns only name and total energy</p>
1028
+
1029
+
1030
+ </div>
1031
+ </div>
1032
+ <div class="tags">
1033
+
1034
+ <p class="tag_title">Returns:</p>
1035
+ <ul class="return">
1036
+
1037
+ <li>
1038
+
1039
+
1040
+ <span class='type'></span>
1041
+
1042
+
1043
+
1044
+
1045
+ <div class='inline'>
1046
+ <p>only name and total energy</p>
1047
+ </div>
1048
+
1049
+ </li>
1050
+
1051
+ </ul>
1052
+
1053
+ </div><table class="source_code">
1054
+ <tr>
1055
+ <td>
1056
+ <pre class="lines">
1057
+
1058
+
1059
+ 35
1060
+ 36
1061
+ 37</pre>
1062
+ </td>
1063
+ <td>
1064
+ <pre class="code"><span class="info file"># File 'lib/pract.rb', line 35</span>
1065
+
1066
+ <span class='kw'>def</span> <span class='id identifier rubyid_show_energy'>show_energy</span>
1067
+ <span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='ivar'>@name</span><span class='embexpr_end'>}</span><span class='tstring_content'>: </span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_energy'>energy</span><span class='period'>.</span><span class='id identifier rubyid_round'>round</span><span class='lparen'>(</span><span class='int'>2</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'> Kcal.</span><span class='tstring_end'>&quot;</span></span>
1068
+ <span class='kw'>end</span></pre>
1069
+ </td>
1070
+ </tr>
1071
+ </table>
1072
+ </div>
1073
+
1074
+ <div class="method_details ">
1075
+ <h3 class="signature " id="to_s-instance_method">
1076
+
1077
+ #<strong>to_s</strong> &#x21d2; <tt>Object</tt>
1078
+
1079
+
1080
+
1081
+
1082
+
1083
+ </h3><div class="docstring">
1084
+ <div class="discussion">
1085
+
1086
+ <p>Returns the format showed by puts</p>
1087
+
1088
+
1089
+ </div>
1090
+ </div>
1091
+ <div class="tags">
1092
+
1093
+ <p class="tag_title">Returns:</p>
1094
+ <ul class="return">
1095
+
1096
+ <li>
1097
+
1098
+
1099
+ <span class='type'></span>
1100
+
1101
+
1102
+
1103
+
1104
+ <div class='inline'>
1105
+ <p>the format showed by puts</p>
1106
+ </div>
1107
+
1108
+ </li>
1109
+
1110
+ </ul>
1111
+
1112
+ </div><table class="source_code">
1113
+ <tr>
1114
+ <td>
1115
+ <pre class="lines">
1116
+
1117
+
1118
+ 31
1119
+ 32
1120
+ 33</pre>
1121
+ </td>
1122
+ <td>
1123
+ <pre class="code"><span class="info file"># File 'lib/pract.rb', line 31</span>
1124
+
1125
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_s'>to_s</span>
1126
+ <span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='ivar'>@name</span><span class='embexpr_end'>}</span><span class='tstring_content'>: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@protein</span><span class='embexpr_end'>}</span><span class='tstring_content'>g proteinas, </span><span class='embexpr_beg'>#{</span><span class='ivar'>@glucid</span><span class='embexpr_end'>}</span><span class='tstring_content'>g glucidos, </span><span class='embexpr_beg'>#{</span><span class='ivar'>@lipid</span><span class='embexpr_end'>}</span><span class='tstring_content'>g grasas</span><span class='tstring_end'>&quot;</span></span>
1127
+ <span class='kw'>end</span></pre>
1128
+ </td>
1129
+ </tr>
1130
+ </table>
1131
+ </div>
1132
+
1133
+ </div>
1134
+
1135
+ </div>
1136
+
1137
+ <div id="footer">
1138
+ Generated on Wed Nov 15 15:04:50 2017 by
1139
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1140
+ 0.9.9 (ruby-2.3.5).
1141
+ </div>
1142
+
1143
+ </div>
1144
+ </body>
1145
+ </html>