P06axz 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +7 -0
  2. data/.coveralls.yml +1 -0
  3. data/.travis.yml +5 -0
  4. data/CODE_OF_CONDUCT.md +74 -0
  5. data/Gemfile +6 -0
  6. data/Guardfile +82 -0
  7. data/LICENSE.txt +21 -0
  8. data/P06.gemspec +44 -0
  9. data/README.md +7 -0
  10. data/Rakefile +6 -0
  11. data/bin/console +14 -0
  12. data/bin/setup +8 -0
  13. data/doc/Alimento.html +825 -0
  14. data/doc/Alimento_concreto.html +396 -0
  15. data/doc/List.html +858 -0
  16. data/doc/Node.html +423 -0
  17. data/doc/P06.html +117 -0
  18. data/doc/_index.html +151 -0
  19. data/doc/class_list.html +51 -0
  20. data/doc/css/common.css +1 -0
  21. data/doc/css/full_list.css +58 -0
  22. data/doc/css/style.css +492 -0
  23. data/doc/file.README.html +78 -0
  24. data/doc/file_list.html +56 -0
  25. data/doc/frames.html +17 -0
  26. data/doc/index.html +78 -0
  27. data/doc/js/app.js +248 -0
  28. data/doc/js/full_list.js +216 -0
  29. data/doc/js/jquery.js +4 -0
  30. data/doc/method_list.html +243 -0
  31. data/doc/top-level-namespace.html +112 -0
  32. data/docs/Alimento.html +682 -0
  33. data/docs/Alimento_concreto.html +389 -0
  34. data/docs/List.html +858 -0
  35. data/docs/Node.html +423 -0
  36. data/docs/P06.html +117 -0
  37. data/docs/_index.html +151 -0
  38. data/docs/class_list.html +51 -0
  39. data/docs/css/common.css +1 -0
  40. data/docs/css/full_list.css +58 -0
  41. data/docs/css/style.css +492 -0
  42. data/docs/file.README.html +79 -0
  43. data/docs/file_list.html +56 -0
  44. data/docs/frames.html +17 -0
  45. data/docs/index.html +79 -0
  46. data/docs/js/app.js +248 -0
  47. data/docs/js/full_list.js +216 -0
  48. data/docs/js/jquery.js +4 -0
  49. data/docs/method_list.html +227 -0
  50. data/docs/top-level-namespace.html +112 -0
  51. data/lib/P06.rb +11 -0
  52. data/lib/P06/alimento.rb +37 -0
  53. data/lib/P06/version.rb +3 -0
  54. data/lib/P07/alimento_concreto.rb +10 -0
  55. data/lib/P07/list.rb +80 -0
  56. data/lib/P08/alimento_concreto.rb +25 -0
  57. data/lib/P08/list.rb +108 -0
  58. data/lib/P10/modified_array.rb +29 -0
  59. data/lib/P11/alimento.rb +29 -0
  60. data/lib/P11/plato.rb +108 -0
  61. data/lib/P11/porciones.rb +31 -0
  62. metadata +233 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 5b4a47c51adbada934d7c4c37a25a5a838491d9ebd0d6bd501262662f6b14da6
4
+ data.tar.gz: a1c859de9af19d8cd66bc233085d0ddd0d919f57730de31789f59f50ed62f9ce
5
+ SHA512:
6
+ metadata.gz: 9238b7cde3263c3c3680dd3985c7a7b19777be074242f35e87296e24522d866dd0f48543e38f554e9dffc5f92cf642823e21d424e54d4fcb2d45ecb7deacd869
7
+ data.tar.gz: 7d313c6e4b69cc5fe07beb8e81c9412e410f6208fac19a1cf24b7abcf7593cbb92ea2fb0f2e9745b9fbbec64427b1475450fb20cb01819f5ae19ad55a724a629
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/.travis.yml ADDED
@@ -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
@@ -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 alu0100949568@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 P06.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 Alberto González Álvarez
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/P06.gemspec ADDED
@@ -0,0 +1,44 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "P06/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "P06axz"
8
+ spec.version = P06::VERSION
9
+ spec.authors = ["Alberto González Álvarez"]
10
+ spec.email = ["alu0100949568@ull.edu.es"]
11
+
12
+ spec.summary = %q{Práctica de laboratorio 5 con alimentos}
13
+ spec.description = %q{Programa en ruby para calcular el valor energético de un alimento dado, teniendo en cuenta los lípidos, hidratos de carbono y proteínas del mismo}
14
+ spec.homepage = "http://google.es"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ if spec.respond_to?(:metadata)
20
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
21
+ else
22
+ raise "RubyGems 2.0 or newer is required to protect against " \
23
+ "public gem pushes."
24
+ end
25
+
26
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
+ f.match(%r{^(test|spec|features)/})
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+
33
+ spec.metadata["yard.run"] = "yri" # use "yard" to build full HTML docs.
34
+
35
+ spec.add_development_dependency "bundler", "~> 1.15"
36
+ spec.add_development_dependency "rake", "~> 10.0"
37
+ spec.add_development_dependency "rspec", "~> 3.0"
38
+ spec.add_development_dependency "guard"
39
+ spec.add_development_dependency "guard-rspec"
40
+ spec.add_development_dependency "guard-bundler"
41
+ spec.add_development_dependency "yard"
42
+ spec.add_development_dependency "yard-rspec"
43
+ spec.add_development_dependency "coveralls"
44
+ end
data/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # Práctica de laboratorio 11
2
+
3
+ ### Alberto Jesús González Álvarez
4
+
5
+ - - -
6
+
7
+ Ordenar un vector de alimentos dado, de forma imperativa, funcional y usando el método sort de ruby, y comparar sus tiempos con el módulo benchmark.sd
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/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "P06"
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
data/doc/Alimento.html ADDED
@@ -0,0 +1,825 @@
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, Enumerable</dd>
93
+ </dl>
94
+
95
+
96
+
97
+
98
+
99
+
100
+ <dl>
101
+ <dt>Defined in:</dt>
102
+ <dd>lib/P06/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 permite representar la información básica de un alimento dado,
111
+ sus proteinas, glúcidos y lípidos además, calcula el índice calórico del
112
+ mismo.</p>
113
+ <dl class="rdoc-list note-list"><dt>Author
114
+ <dd>
115
+ <p>Alberto González (<a
116
+ href="mailto:alu0100949568@ull.edu.es">alu0100949568@ull.edu.es</a>)</p>
117
+ </dd><dt>Copyright
118
+ <dd>
119
+ <p>Cretive Commons</p>
120
+ </dd><dt>License
121
+ <dd>
122
+ <p>Distributes under the same terms as Ruby</p>
123
+ </dd></dl>
124
+
125
+
126
+ </div>
127
+ </div>
128
+ <div class="tags">
129
+
130
+
131
+ </div><div id="subclasses">
132
+ <h2>Direct Known Subclasses</h2>
133
+ <p class="children"><span class='object_link'><a href="Alimento_concreto.html" title="Alimento_concreto (class)">Alimento_concreto</a></span></p>
134
+ </div>
135
+
136
+
137
+
138
+
139
+ <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
140
+ <ul class="summary">
141
+
142
+ <li class="public ">
143
+ <span class="summary_signature">
144
+
145
+ <a href="#cal_index-instance_method" title="#cal_index (instance method)">#<strong>cal_index</strong> &#x21d2; Object </a>
146
+
147
+
148
+
149
+ </span>
150
+
151
+
152
+
153
+
154
+ <span class="note title readonly">readonly</span>
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+ <span class="summary_desc"><div class='inline'>
165
+ <p>Returns the value of attribute cal_index.</p>
166
+ </div></span>
167
+
168
+ </li>
169
+
170
+
171
+ <li class="public ">
172
+ <span class="summary_signature">
173
+
174
+ <a href="#gluc-instance_method" title="#gluc (instance method)">#<strong>gluc</strong> &#x21d2; Object </a>
175
+
176
+
177
+
178
+ </span>
179
+
180
+
181
+
182
+
183
+ <span class="note title readonly">readonly</span>
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+ <span class="summary_desc"><div class='inline'>
194
+ <p>Returns the value of attribute gluc.</p>
195
+ </div></span>
196
+
197
+ </li>
198
+
199
+
200
+ <li class="public ">
201
+ <span class="summary_signature">
202
+
203
+ <a href="#lip-instance_method" title="#lip (instance method)">#<strong>lip</strong> &#x21d2; Object </a>
204
+
205
+
206
+
207
+ </span>
208
+
209
+
210
+
211
+
212
+ <span class="note title readonly">readonly</span>
213
+
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+ <span class="summary_desc"><div class='inline'>
223
+ <p>Returns the value of attribute lip.</p>
224
+ </div></span>
225
+
226
+ </li>
227
+
228
+
229
+ <li class="public ">
230
+ <span class="summary_signature">
231
+
232
+ <a href="#nom-instance_method" title="#nom (instance method)">#<strong>nom</strong> &#x21d2; Object </a>
233
+
234
+
235
+
236
+ </span>
237
+
238
+
239
+
240
+
241
+ <span class="note title readonly">readonly</span>
242
+
243
+
244
+
245
+
246
+
247
+
248
+
249
+
250
+
251
+ <span class="summary_desc"><div class='inline'>
252
+ <p>Returns the value of attribute nom.</p>
253
+ </div></span>
254
+
255
+ </li>
256
+
257
+
258
+ <li class="public ">
259
+ <span class="summary_signature">
260
+
261
+ <a href="#prot-instance_method" title="#prot (instance method)">#<strong>prot</strong> &#x21d2; Object </a>
262
+
263
+
264
+
265
+ </span>
266
+
267
+
268
+
269
+
270
+ <span class="note title readonly">readonly</span>
271
+
272
+
273
+
274
+
275
+
276
+
277
+
278
+
279
+
280
+ <span class="summary_desc"><div class='inline'>
281
+ <p>Returns the value of attribute prot.</p>
282
+ </div></span>
283
+
284
+ </li>
285
+
286
+
287
+ </ul>
288
+
289
+
290
+
291
+
292
+
293
+ <h2>
294
+ Instance Method Summary
295
+ <small><a href="#" class="summary_toggle">collapse</a></small>
296
+ </h2>
297
+
298
+ <ul class="summary">
299
+
300
+ <li class="public ">
301
+ <span class="summary_signature">
302
+
303
+ <a href="#aibc-instance_method" title="#aibc (instance method)">#<strong>aibc</strong> &#x21d2; Object </a>
304
+
305
+
306
+
307
+ </span>
308
+
309
+
310
+
311
+
312
+
313
+
314
+
315
+
316
+
317
+ <span class="summary_desc"><div class='inline'>
318
+ <p>Calcula el área bajo la curva para los datos tomados en una medición de
319
+ glucosa en intervalos de tiempo de 5 minutos.</p>
320
+ </div></span>
321
+
322
+ </li>
323
+
324
+
325
+ <li class="public ">
326
+ <span class="summary_signature">
327
+
328
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(nom, prot, gluc, lip, gluc_data = nil) &#x21d2; Alimento </a>
329
+
330
+
331
+
332
+ </span>
333
+
334
+
335
+ <span class="note title constructor">constructor</span>
336
+
337
+
338
+
339
+
340
+
341
+
342
+
343
+
344
+ <span class="summary_desc"><div class='inline'>
345
+ <p>Se asigna el nombre y la información nutricional del alimento.</p>
346
+ </div></span>
347
+
348
+ </li>
349
+
350
+
351
+ <li class="public ">
352
+ <span class="summary_signature">
353
+
354
+ <a href="#not_negative-instance_method" title="#not_negative (instance method)">#<strong>not_negative</strong>(n) &#x21d2; Object </a>
355
+
356
+
357
+
358
+ </span>
359
+
360
+
361
+
362
+
363
+
364
+
365
+
366
+
367
+
368
+ <span class="summary_desc"><div class='inline'>
369
+ <p>Se comprueba que no sea un valor negativo, en caso de serlo, se sustituye
370
+ por un 0.</p>
371
+ </div></span>
372
+
373
+ </li>
374
+
375
+
376
+ <li class="public ">
377
+ <span class="summary_signature">
378
+
379
+ <a href="#to_s-instance_method" title="#to_s (instance method)">#<strong>to_s</strong> &#x21d2; Object </a>
380
+
381
+
382
+
383
+ </span>
384
+
385
+
386
+
387
+
388
+
389
+
390
+
391
+
392
+
393
+ <span class="summary_desc"><div class='inline'>
394
+ <p>Muestra la información de un alimento en concreto.</p>
395
+ </div></span>
396
+
397
+ </li>
398
+
399
+
400
+ </ul>
401
+
402
+
403
+
404
+
405
+ <div id="constructor_details" class="method_details_list">
406
+ <h2>Constructor Details</h2>
407
+
408
+ <div class="method_details first">
409
+ <h3 class="signature first" id="initialize-instance_method">
410
+
411
+ #<strong>initialize</strong>(nom, prot, gluc, lip, gluc_data = nil) &#x21d2; <tt><span class='object_link'><a href="" title="Alimento (class)">Alimento</a></span></tt>
412
+
413
+
414
+
415
+
416
+
417
+ </h3><div class="docstring">
418
+ <div class="discussion">
419
+
420
+ <p>Se asigna el nombre y la información nutricional del alimento</p>
421
+
422
+
423
+ </div>
424
+ </div>
425
+ <div class="tags">
426
+
427
+
428
+ </div><table class="source_code">
429
+ <tr>
430
+ <td>
431
+ <pre class="lines">
432
+
433
+
434
+ 12
435
+ 13
436
+ 14
437
+ 15
438
+ 16
439
+ 17
440
+ 18
441
+ 19</pre>
442
+ </td>
443
+ <td>
444
+ <pre class="code"><span class="info file"># File 'lib/P06/alimento.rb', line 12</span>
445
+
446
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_nom'>nom</span><span class='comma'>,</span> <span class='id identifier rubyid_prot'>prot</span><span class='comma'>,</span> <span class='id identifier rubyid_gluc'>gluc</span><span class='comma'>,</span> <span class='id identifier rubyid_lip'>lip</span><span class='comma'>,</span> <span class='id identifier rubyid_gluc_data'>gluc_data</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
447
+ <span class='ivar'>@nom</span> <span class='op'>=</span> <span class='id identifier rubyid_nom'>nom</span>
448
+ <span class='ivar'>@prot</span> <span class='op'>=</span> <span class='id identifier rubyid_prot'>prot</span>
449
+ <span class='ivar'>@gluc</span> <span class='op'>=</span> <span class='id identifier rubyid_gluc'>gluc</span>
450
+ <span class='ivar'>@lip</span> <span class='op'>=</span> <span class='id identifier rubyid_lip'>lip</span>
451
+ <span class='ivar'>@gluc_data</span> <span class='op'>=</span> <span class='id identifier rubyid_gluc_data'>gluc_data</span>
452
+ <span class='ivar'>@cal_index</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='ivar'>@prot</span><span class='period'>.</span><span class='id identifier rubyid_to_f'>to_f</span><span class='op'>*</span><span class='int'>4</span> <span class='op'>+</span> <span class='ivar'>@gluc</span><span class='period'>.</span><span class='id identifier rubyid_to_f'>to_f</span><span class='op'>*</span><span class='int'>4</span> <span class='op'>+</span> <span class='ivar'>@lip</span><span class='period'>.</span><span class='id identifier rubyid_to_f'>to_f</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'>2</span><span class='rparen'>)</span>
453
+ <span class='kw'>end</span></pre>
454
+ </td>
455
+ </tr>
456
+ </table>
457
+ </div>
458
+
459
+ </div>
460
+
461
+ <div id="instance_attr_details" class="attr_details">
462
+ <h2>Instance Attribute Details</h2>
463
+
464
+
465
+ <span id=""></span>
466
+ <div class="method_details first">
467
+ <h3 class="signature first" id="cal_index-instance_method">
468
+
469
+ #<strong>cal_index</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
470
+
471
+
472
+
473
+
474
+
475
+ </h3><div class="docstring">
476
+ <div class="discussion">
477
+
478
+ <p>Returns the value of attribute cal_index</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
+ 9
493
+ 10
494
+ 11</pre>
495
+ </td>
496
+ <td>
497
+ <pre class="code"><span class="info file"># File 'lib/P06/alimento.rb', line 9</span>
498
+
499
+ <span class='kw'>def</span> <span class='id identifier rubyid_cal_index'>cal_index</span>
500
+ <span class='ivar'>@cal_index</span>
501
+ <span class='kw'>end</span></pre>
502
+ </td>
503
+ </tr>
504
+ </table>
505
+ </div>
506
+
507
+
508
+ <span id=""></span>
509
+ <div class="method_details ">
510
+ <h3 class="signature " id="gluc-instance_method">
511
+
512
+ #<strong>gluc</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
513
+
514
+
515
+
516
+
517
+
518
+ </h3><div class="docstring">
519
+ <div class="discussion">
520
+
521
+ <p>Returns the value of attribute gluc</p>
522
+
523
+
524
+ </div>
525
+ </div>
526
+ <div class="tags">
527
+
528
+
529
+ </div><table class="source_code">
530
+ <tr>
531
+ <td>
532
+ <pre class="lines">
533
+
534
+
535
+ 9
536
+ 10
537
+ 11</pre>
538
+ </td>
539
+ <td>
540
+ <pre class="code"><span class="info file"># File 'lib/P06/alimento.rb', line 9</span>
541
+
542
+ <span class='kw'>def</span> <span class='id identifier rubyid_gluc'>gluc</span>
543
+ <span class='ivar'>@gluc</span>
544
+ <span class='kw'>end</span></pre>
545
+ </td>
546
+ </tr>
547
+ </table>
548
+ </div>
549
+
550
+
551
+ <span id=""></span>
552
+ <div class="method_details ">
553
+ <h3 class="signature " id="lip-instance_method">
554
+
555
+ #<strong>lip</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
556
+
557
+
558
+
559
+
560
+
561
+ </h3><div class="docstring">
562
+ <div class="discussion">
563
+
564
+ <p>Returns the value of attribute lip</p>
565
+
566
+
567
+ </div>
568
+ </div>
569
+ <div class="tags">
570
+
571
+
572
+ </div><table class="source_code">
573
+ <tr>
574
+ <td>
575
+ <pre class="lines">
576
+
577
+
578
+ 9
579
+ 10
580
+ 11</pre>
581
+ </td>
582
+ <td>
583
+ <pre class="code"><span class="info file"># File 'lib/P06/alimento.rb', line 9</span>
584
+
585
+ <span class='kw'>def</span> <span class='id identifier rubyid_lip'>lip</span>
586
+ <span class='ivar'>@lip</span>
587
+ <span class='kw'>end</span></pre>
588
+ </td>
589
+ </tr>
590
+ </table>
591
+ </div>
592
+
593
+
594
+ <span id=""></span>
595
+ <div class="method_details ">
596
+ <h3 class="signature " id="nom-instance_method">
597
+
598
+ #<strong>nom</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
599
+
600
+
601
+
602
+
603
+
604
+ </h3><div class="docstring">
605
+ <div class="discussion">
606
+
607
+ <p>Returns the value of attribute nom</p>
608
+
609
+
610
+ </div>
611
+ </div>
612
+ <div class="tags">
613
+
614
+
615
+ </div><table class="source_code">
616
+ <tr>
617
+ <td>
618
+ <pre class="lines">
619
+
620
+
621
+ 9
622
+ 10
623
+ 11</pre>
624
+ </td>
625
+ <td>
626
+ <pre class="code"><span class="info file"># File 'lib/P06/alimento.rb', line 9</span>
627
+
628
+ <span class='kw'>def</span> <span class='id identifier rubyid_nom'>nom</span>
629
+ <span class='ivar'>@nom</span>
630
+ <span class='kw'>end</span></pre>
631
+ </td>
632
+ </tr>
633
+ </table>
634
+ </div>
635
+
636
+
637
+ <span id=""></span>
638
+ <div class="method_details ">
639
+ <h3 class="signature " id="prot-instance_method">
640
+
641
+ #<strong>prot</strong> &#x21d2; <tt>Object</tt> <span class="extras">(readonly)</span>
642
+
643
+
644
+
645
+
646
+
647
+ </h3><div class="docstring">
648
+ <div class="discussion">
649
+
650
+ <p>Returns the value of attribute prot</p>
651
+
652
+
653
+ </div>
654
+ </div>
655
+ <div class="tags">
656
+
657
+
658
+ </div><table class="source_code">
659
+ <tr>
660
+ <td>
661
+ <pre class="lines">
662
+
663
+
664
+ 9
665
+ 10
666
+ 11</pre>
667
+ </td>
668
+ <td>
669
+ <pre class="code"><span class="info file"># File 'lib/P06/alimento.rb', line 9</span>
670
+
671
+ <span class='kw'>def</span> <span class='id identifier rubyid_prot'>prot</span>
672
+ <span class='ivar'>@prot</span>
673
+ <span class='kw'>end</span></pre>
674
+ </td>
675
+ </tr>
676
+ </table>
677
+ </div>
678
+
679
+ </div>
680
+
681
+
682
+ <div id="instance_method_details" class="method_details_list">
683
+ <h2>Instance Method Details</h2>
684
+
685
+
686
+ <div class="method_details first">
687
+ <h3 class="signature first" id="aibc-instance_method">
688
+
689
+ #<strong>aibc</strong> &#x21d2; <tt>Object</tt>
690
+
691
+
692
+
693
+
694
+
695
+ </h3><div class="docstring">
696
+ <div class="discussion">
697
+
698
+ <p>Calcula el área bajo la curva para los datos tomados en una medición de
699
+ glucosa en intervalos de tiempo de 5 minutos</p>
700
+
701
+
702
+ </div>
703
+ </div>
704
+ <div class="tags">
705
+
706
+
707
+ </div><table class="source_code">
708
+ <tr>
709
+ <td>
710
+ <pre class="lines">
711
+
712
+
713
+ 33
714
+ 34
715
+ 35</pre>
716
+ </td>
717
+ <td>
718
+ <pre class="code"><span class="info file"># File 'lib/P06/alimento.rb', line 33</span>
719
+
720
+ <span class='kw'>def</span> <span class='id identifier rubyid_aibc'>aibc</span>
721
+ <span class='ivar'>@gluc_data</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_indv'>indv</span><span class='op'>|</span> <span class='id identifier rubyid_zero'>zero</span> <span class='op'>=</span> <span class='id identifier rubyid_indv'>indv</span><span class='period'>.</span><span class='id identifier rubyid_at'>at</span><span class='lparen'>(</span><span class='int'>0</span><span class='rparen'>)</span><span class='semicolon'>;</span> <span class='id identifier rubyid_prev'>prev</span> <span class='op'>=</span> <span class='op'>-</span><span class='int'>2</span><span class='semicolon'>;</span> <span class='id identifier rubyid_indv'>indv</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_index'>index</span><span class='op'>|</span> <span class='id identifier rubyid_prev'>prev</span> <span class='op'>=</span> <span class='id identifier rubyid_prev'>prev</span> <span class='op'>+</span> <span class='int'>1</span><span class='semicolon'>;</span> <span class='lparen'>(</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='op'>-</span><span class='id identifier rubyid_zero'>zero</span><span class='rparen'>)</span> <span class='op'>+</span> <span class='lparen'>(</span><span class='id identifier rubyid_indv'>indv</span><span class='period'>.</span><span class='id identifier rubyid_at'>at</span><span class='lparen'>(</span><span class='id identifier rubyid_not_negative'>not_negative</span><span class='lparen'>(</span><span class='id identifier rubyid_prev'>prev</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='op'>-</span><span class='id identifier rubyid_zero'>zero</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='op'>*</span><span class='float'>2.5</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_reduce'>reduce</span><span class='lparen'>(</span><span class='symbol'>:+</span><span class='rparen'>)</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='rbrace'>}</span>
722
+ <span class='kw'>end</span></pre>
723
+ </td>
724
+ </tr>
725
+ </table>
726
+ </div>
727
+
728
+ <div class="method_details ">
729
+ <h3 class="signature " id="not_negative-instance_method">
730
+
731
+ #<strong>not_negative</strong>(n) &#x21d2; <tt>Object</tt>
732
+
733
+
734
+
735
+
736
+
737
+ </h3><div class="docstring">
738
+ <div class="discussion">
739
+
740
+ <p>Se comprueba que no sea un valor negativo, en caso de serlo, se sustituye
741
+ por un 0</p>
742
+
743
+
744
+ </div>
745
+ </div>
746
+ <div class="tags">
747
+
748
+
749
+ </div><table class="source_code">
750
+ <tr>
751
+ <td>
752
+ <pre class="lines">
753
+
754
+
755
+ 28
756
+ 29
757
+ 30</pre>
758
+ </td>
759
+ <td>
760
+ <pre class="code"><span class="info file"># File 'lib/P06/alimento.rb', line 28</span>
761
+
762
+ <span class='kw'>def</span> <span class='id identifier rubyid_not_negative'>not_negative</span><span class='lparen'>(</span><span class='id identifier rubyid_n'>n</span><span class='rparen'>)</span>
763
+ <span class='id identifier rubyid_n'>n</span> <span class='op'>&lt;</span> <span class='int'>0</span> <span class='op'>?</span> <span class='id identifier rubyid_n'>n</span> <span class='op'>=</span> <span class='int'>0</span> <span class='op'>:</span> <span class='id identifier rubyid_n'>n</span> <span class='op'>=</span> <span class='id identifier rubyid_n'>n</span>
764
+ <span class='kw'>end</span></pre>
765
+ </td>
766
+ </tr>
767
+ </table>
768
+ </div>
769
+
770
+ <div class="method_details ">
771
+ <h3 class="signature " id="to_s-instance_method">
772
+
773
+ #<strong>to_s</strong> &#x21d2; <tt>Object</tt>
774
+
775
+
776
+
777
+
778
+
779
+ </h3><div class="docstring">
780
+ <div class="discussion">
781
+
782
+ <p>Muestra la información de un alimento en concreto</p>
783
+
784
+
785
+ </div>
786
+ </div>
787
+ <div class="tags">
788
+
789
+
790
+ </div><table class="source_code">
791
+ <tr>
792
+ <td>
793
+ <pre class="lines">
794
+
795
+
796
+ 22
797
+ 23
798
+ 24
799
+ 25</pre>
800
+ </td>
801
+ <td>
802
+ <pre class="code"><span class="info file"># File 'lib/P06/alimento.rb', line 22</span>
803
+
804
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_s'>to_s</span>
805
+ <span class='comment'>#El huevo frito tiene 14.1 proteinas, 0.0 glúcidos, 19.5 lípidos
806
+ </span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='ivar'>@nom</span><span class='embexpr_end'>}</span><span class='tstring_content'>: </span><span class='embexpr_beg'>#{</span><span class='ivar'>@prot</span><span class='embexpr_end'>}</span><span class='tstring_content'> proteinas, </span><span class='embexpr_beg'>#{</span><span class='ivar'>@gluc</span><span class='embexpr_end'>}</span><span class='tstring_content'> glúcidos, </span><span class='embexpr_beg'>#{</span><span class='ivar'>@lip</span><span class='embexpr_end'>}</span><span class='tstring_content'> lípidos, </span><span class='embexpr_beg'>#{</span><span class='ivar'>@cal_index</span><span class='embexpr_end'>}</span><span class='tstring_content'> calorías</span><span class='tstring_end'>&quot;</span></span>
807
+ <span class='kw'>end</span></pre>
808
+ </td>
809
+ </tr>
810
+ </table>
811
+ </div>
812
+
813
+ </div>
814
+
815
+ </div>
816
+
817
+ <div id="footer">
818
+ Generated on Wed Nov 22 11:59:57 2017 by
819
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
820
+ 0.9.9 (ruby-2.3.0).
821
+ </div>
822
+
823
+ </div>
824
+ </body>
825
+ </html>