food_alu0100904406 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +12 -0
- data/.travis.yml +6 -0
- data/Gemfile +6 -0
- data/Guardfile +82 -0
- data/README.md +40 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/docs/Alimento_.html +407 -0
- data/docs/Food.html +110 -0
- data/docs/Gemfile.html +100 -0
- data/docs/Gemfile_lock.html +177 -0
- data/docs/Grupo_alimento.html +235 -0
- data/docs/Guardfile.html +177 -0
- data/docs/Lista.html +365 -0
- data/docs/Object.html +118 -0
- data/docs/README_md.html +151 -0
- data/docs/Rakefile.html +98 -0
- data/docs/bin/setup.html +98 -0
- data/docs/created.rid +16 -0
- data/docs/css/fonts.css +167 -0
- data/docs/css/rdoc.css +590 -0
- data/docs/fonts/Lato-Light.ttf +0 -0
- data/docs/fonts/Lato-LightItalic.ttf +0 -0
- data/docs/fonts/Lato-Regular.ttf +0 -0
- data/docs/fonts/Lato-RegularItalic.ttf +0 -0
- data/docs/fonts/SourceCodePro-Bold.ttf +0 -0
- data/docs/fonts/SourceCodePro-Regular.ttf +0 -0
- data/docs/food_gemspec.html +130 -0
- data/docs/images/add.png +0 -0
- data/docs/images/arrow_up.png +0 -0
- data/docs/images/brick.png +0 -0
- data/docs/images/brick_link.png +0 -0
- data/docs/images/bug.png +0 -0
- data/docs/images/bullet_black.png +0 -0
- data/docs/images/bullet_toggle_minus.png +0 -0
- data/docs/images/bullet_toggle_plus.png +0 -0
- data/docs/images/date.png +0 -0
- data/docs/images/delete.png +0 -0
- data/docs/images/find.png +0 -0
- data/docs/images/loadingAnimation.gif +0 -0
- data/docs/images/macFFBgHack.png +0 -0
- data/docs/images/package.png +0 -0
- data/docs/images/page_green.png +0 -0
- data/docs/images/page_white_text.png +0 -0
- data/docs/images/page_white_width.png +0 -0
- data/docs/images/plugin.png +0 -0
- data/docs/images/ruby.png +0 -0
- data/docs/images/tag_blue.png +0 -0
- data/docs/images/tag_green.png +0 -0
- data/docs/images/transparent.png +0 -0
- data/docs/images/wrench.png +0 -0
- data/docs/images/wrench_orange.png +0 -0
- data/docs/images/zoom.png +0 -0
- data/docs/index.html +110 -0
- data/docs/js/darkfish.js +161 -0
- data/docs/js/jquery.js +4 -0
- data/docs/js/navigation.js +142 -0
- data/docs/js/navigation.js.gz +0 -0
- data/docs/js/search.js +109 -0
- data/docs/js/search_index.js +1 -0
- data/docs/js/search_index.js.gz +0 -0
- data/docs/js/searcher.js +229 -0
- data/docs/js/searcher.js.gz +0 -0
- data/docs/table_of_contents.html +150 -0
- data/food.gemspec +39 -0
- data/lib/food/food_.rb +73 -0
- data/lib/food/list.rb +104 -0
- data/lib/food/plato.rb +146 -0
- data/lib/food/version.rb +3 -0
- data/lib/food.rb +8 -0
- metadata +213 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: befad3bc9e4ccfee2b55bf8a19c4df8c0ff060f5
|
4
|
+
data.tar.gz: '087bf0544222d644ffe26b179f79e9134ad1479e'
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a87fc3d2fb8a1dd2fbbb9d83a8cab1d3c6c3c6fab1538ba3331d68fabb3ccb2236e34517a2dc6bf5e4f5194344bdff212336bad68a0e35c35aa53f9cbb844f1d
|
7
|
+
data.tar.gz: 884eb0f8601a4e2facceb93a932acf3b9034c23f8a1f276d704485b3966dd876dc42d5157e1167b41db3d4c43fac56c16ce664ca69589b8ce8f428478979628d
|
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
service_name: travis-ci
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
## Uncomment and set this to only include directories you want to watch
|
5
|
+
# directories %w(app lib config test spec features) \
|
6
|
+
# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
7
|
+
|
8
|
+
## Note: if you are using the `directories` clause above and you are not
|
9
|
+
## watching the project directory ('.'), then you will want to move
|
10
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
11
|
+
#
|
12
|
+
# $ mkdir config
|
13
|
+
# $ mv Guardfile config/
|
14
|
+
# $ ln -s config/Guardfile .
|
15
|
+
#
|
16
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
17
|
+
|
18
|
+
guard :bundler do
|
19
|
+
require 'guard/bundler'
|
20
|
+
require 'guard/bundler/verify'
|
21
|
+
helper = Guard::Bundler::Verify.new
|
22
|
+
|
23
|
+
files = ['Gemfile']
|
24
|
+
files += Dir['*.gemspec'] if files.any? { |f| helper.uses_gemspec?(f) }
|
25
|
+
|
26
|
+
# Assume files are symlinked from somewhere
|
27
|
+
files.each { |file| watch(helper.real_path(file)) }
|
28
|
+
end
|
29
|
+
|
30
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
31
|
+
# rspec may be run, below are examples of the most common uses.
|
32
|
+
# * bundler: 'bundle exec rspec'
|
33
|
+
# * bundler binstubs: 'bin/rspec'
|
34
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
35
|
+
# installed the spring binstubs per the docs)
|
36
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
37
|
+
# * 'just' rspec: 'rspec'
|
38
|
+
|
39
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
40
|
+
require "guard/rspec/dsl"
|
41
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
42
|
+
|
43
|
+
# Feel free to open issues for suggestions and improvements
|
44
|
+
|
45
|
+
# RSpec files
|
46
|
+
rspec = dsl.rspec
|
47
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
48
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
49
|
+
watch(rspec.spec_files)
|
50
|
+
|
51
|
+
# Ruby files
|
52
|
+
ruby = dsl.ruby
|
53
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
54
|
+
|
55
|
+
# Rails files
|
56
|
+
rails = dsl.rails(view_extensions: %w(erb haml slim))
|
57
|
+
dsl.watch_spec_files_for(rails.app_files)
|
58
|
+
dsl.watch_spec_files_for(rails.views)
|
59
|
+
|
60
|
+
watch(rails.controllers) do |m|
|
61
|
+
[
|
62
|
+
rspec.spec.call("routing/#{m[1]}_routing"),
|
63
|
+
rspec.spec.call("controllers/#{m[1]}_controller"),
|
64
|
+
rspec.spec.call("acceptance/#{m[1]}")
|
65
|
+
]
|
66
|
+
end
|
67
|
+
|
68
|
+
# Rails config changes
|
69
|
+
watch(rails.spec_helper) { rspec.spec_dir }
|
70
|
+
watch(rails.routes) { "#{rspec.spec_dir}/routing" }
|
71
|
+
watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
|
72
|
+
|
73
|
+
# Capybara features specs
|
74
|
+
watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
|
75
|
+
watch(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") }
|
76
|
+
|
77
|
+
# Turnip features and steps
|
78
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
79
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
|
80
|
+
Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
|
81
|
+
end
|
82
|
+
end
|
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# Food
|
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/food`. 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 'food'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install food
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
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]/food.
|
36
|
+
|
37
|
+
## Coveralls
|
38
|
+
|
39
|
+
[](https://coveralls.io/github/alu0100904406/gema?branch=desarrollo10)
|
40
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "food"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/docs/Alimento_.html
ADDED
@@ -0,0 +1,407 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class Alimento_ - RDoc Documentation</title>
|
8
|
+
|
9
|
+
<script type="text/javascript">
|
10
|
+
var rdoc_rel_prefix = "./";
|
11
|
+
var index_rel_prefix = "./";
|
12
|
+
</script>
|
13
|
+
|
14
|
+
<script src="./js/jquery.js"></script>
|
15
|
+
<script src="./js/darkfish.js"></script>
|
16
|
+
|
17
|
+
<link href="./css/fonts.css" rel="stylesheet">
|
18
|
+
<link href="./css/rdoc.css" rel="stylesheet">
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
<body id="top" role="document" class="class">
|
23
|
+
<nav role="navigation">
|
24
|
+
<div id="project-navigation">
|
25
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
26
|
+
<h2>
|
27
|
+
<a href="./index.html" rel="home">Home</a>
|
28
|
+
</h2>
|
29
|
+
|
30
|
+
<div id="table-of-contents-navigation">
|
31
|
+
<a href="./table_of_contents.html#pages">Pages</a>
|
32
|
+
<a href="./table_of_contents.html#classes">Classes</a>
|
33
|
+
<a href="./table_of_contents.html#methods">Methods</a>
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
|
37
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
38
|
+
<form action="#" method="get" accept-charset="utf-8">
|
39
|
+
<div id="search-field-wrapper">
|
40
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
41
|
+
aria-autocomplete="list" aria-controls="search-results"
|
42
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
43
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<ul id="search-results" aria-label="Search Results"
|
47
|
+
aria-busy="false" aria-expanded="false"
|
48
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
49
|
+
</form>
|
50
|
+
</div>
|
51
|
+
|
52
|
+
</div>
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
<div id="class-metadata">
|
57
|
+
|
58
|
+
<div id="parent-class-section" class="nav-section">
|
59
|
+
<h3>Parent</h3>
|
60
|
+
|
61
|
+
|
62
|
+
<p class="link"><a href="Object.html">Object</a>
|
63
|
+
|
64
|
+
</div>
|
65
|
+
|
66
|
+
<div id="includes-section" class="nav-section">
|
67
|
+
<h3>Included Modules</h3>
|
68
|
+
|
69
|
+
<ul class="link-list">
|
70
|
+
|
71
|
+
|
72
|
+
<li><span class="include">Comparable</span>
|
73
|
+
|
74
|
+
|
75
|
+
</ul>
|
76
|
+
</div>
|
77
|
+
|
78
|
+
|
79
|
+
<!-- Method Quickref -->
|
80
|
+
<div id="method-list-section" class="nav-section">
|
81
|
+
<h3>Methods</h3>
|
82
|
+
|
83
|
+
<ul class="link-list" role="directory">
|
84
|
+
|
85
|
+
<li ><a href="#method-c-new">::new</a>
|
86
|
+
|
87
|
+
<li ><a href="#method-i-3C-3D-3E">#<=></a>
|
88
|
+
|
89
|
+
<li ><a href="#method-i-aibc">#aibc</a>
|
90
|
+
|
91
|
+
<li ><a href="#method-i-to_s">#to_s</a>
|
92
|
+
|
93
|
+
<li ><a href="#method-i-valor_energetico">#valor_energetico</a>
|
94
|
+
|
95
|
+
</ul>
|
96
|
+
</div>
|
97
|
+
|
98
|
+
</div>
|
99
|
+
</nav>
|
100
|
+
|
101
|
+
<main role="main" aria-labelledby="class-Alimento_">
|
102
|
+
<h1 id="class-Alimento_" class="class">
|
103
|
+
class Alimento_
|
104
|
+
</h1>
|
105
|
+
|
106
|
+
<section class="description">
|
107
|
+
|
108
|
+
<p>Esta clase permite representar un alimento.</p>
|
109
|
+
|
110
|
+
</section>
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
<section class="attribute-method-details" class="method-section">
|
124
|
+
<header>
|
125
|
+
<h3>Attributes</h3>
|
126
|
+
</header>
|
127
|
+
|
128
|
+
|
129
|
+
<div id="attribute-i-datos" class="method-detail">
|
130
|
+
<div class="method-heading attribute-method-heading">
|
131
|
+
<span class="method-name">datos</span><span
|
132
|
+
class="attribute-access-type">[RW]</span>
|
133
|
+
</div>
|
134
|
+
|
135
|
+
<div class="method-description">
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
</div>
|
140
|
+
</div>
|
141
|
+
|
142
|
+
<div id="attribute-i-glucidos" class="method-detail">
|
143
|
+
<div class="method-heading attribute-method-heading">
|
144
|
+
<span class="method-name">glucidos</span><span
|
145
|
+
class="attribute-access-type">[R]</span>
|
146
|
+
</div>
|
147
|
+
|
148
|
+
<div class="method-description">
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
</div>
|
153
|
+
</div>
|
154
|
+
|
155
|
+
<div id="attribute-i-lipidos" class="method-detail">
|
156
|
+
<div class="method-heading attribute-method-heading">
|
157
|
+
<span class="method-name">lipidos</span><span
|
158
|
+
class="attribute-access-type">[R]</span>
|
159
|
+
</div>
|
160
|
+
|
161
|
+
<div class="method-description">
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
</div>
|
166
|
+
</div>
|
167
|
+
|
168
|
+
<div id="attribute-i-nombre" class="method-detail">
|
169
|
+
<div class="method-heading attribute-method-heading">
|
170
|
+
<span class="method-name">nombre</span><span
|
171
|
+
class="attribute-access-type">[R]</span>
|
172
|
+
</div>
|
173
|
+
|
174
|
+
<div class="method-description">
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
</div>
|
179
|
+
</div>
|
180
|
+
|
181
|
+
<div id="attribute-i-proteinas" class="method-detail">
|
182
|
+
<div class="method-heading attribute-method-heading">
|
183
|
+
<span class="method-name">proteinas</span><span
|
184
|
+
class="attribute-access-type">[R]</span>
|
185
|
+
</div>
|
186
|
+
|
187
|
+
<div class="method-description">
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
</div>
|
192
|
+
</div>
|
193
|
+
|
194
|
+
</section>
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
199
|
+
<header>
|
200
|
+
<h3>Public Class Methods</h3>
|
201
|
+
</header>
|
202
|
+
|
203
|
+
|
204
|
+
<div id="method-c-new" class="method-detail ">
|
205
|
+
|
206
|
+
<div class="method-heading">
|
207
|
+
<span class="method-name">new</span><span
|
208
|
+
class="method-args">(nombre, proteinas, lipidos, glucidos)</span>
|
209
|
+
|
210
|
+
<span class="method-click-advice">click to toggle source</span>
|
211
|
+
|
212
|
+
</div>
|
213
|
+
|
214
|
+
|
215
|
+
<div class="method-description">
|
216
|
+
|
217
|
+
<p>Constructor al que se le pasa el nombre del alimmento, cantidad de
|
218
|
+
proteinas, cantidad de lipidos y cantidad de glucidos</p>
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
<div class="method-source-code" id="new-source">
|
224
|
+
<pre><span class="ruby-comment"># File lib/food/food_.rb, line 17</span>
|
225
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">nombre</span>, <span class="ruby-identifier">proteinas</span>, <span class="ruby-identifier">lipidos</span>, <span class="ruby-identifier">glucidos</span>)
|
226
|
+
<span class="ruby-ivar">@nombre</span>=<span class="ruby-identifier">nombre</span>
|
227
|
+
<span class="ruby-ivar">@proteinas</span>=<span class="ruby-identifier">proteinas</span>
|
228
|
+
<span class="ruby-ivar">@lipidos</span>=<span class="ruby-identifier">lipidos</span>
|
229
|
+
<span class="ruby-ivar">@glucidos</span>=<span class="ruby-identifier">glucidos</span>
|
230
|
+
<span class="ruby-keyword">end</span></pre>
|
231
|
+
</div>
|
232
|
+
|
233
|
+
</div>
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
</div>
|
239
|
+
|
240
|
+
|
241
|
+
</section>
|
242
|
+
|
243
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
244
|
+
<header>
|
245
|
+
<h3>Public Instance Methods</h3>
|
246
|
+
</header>
|
247
|
+
|
248
|
+
|
249
|
+
<div id="method-i-3C-3D-3E" class="method-detail ">
|
250
|
+
|
251
|
+
<div class="method-heading">
|
252
|
+
<span class="method-name"><=></span><span
|
253
|
+
class="method-args">(another)</span>
|
254
|
+
|
255
|
+
<span class="method-click-advice">click to toggle source</span>
|
256
|
+
|
257
|
+
</div>
|
258
|
+
|
259
|
+
|
260
|
+
<div class="method-description">
|
261
|
+
|
262
|
+
<p>Sobrecarga del metodo <=> para que un <a
|
263
|
+
href="Alimento_.html">Alimento_</a> se compare con otro a través de su
|
264
|
+
valor ennergético.</p>
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
<div class="method-source-code" id="3C-3D-3E-source">
|
270
|
+
<pre><span class="ruby-comment"># File lib/food/food_.rb, line 37</span>
|
271
|
+
<span class="ruby-keyword">def</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">another</span>
|
272
|
+
<span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">another</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Alimento_</span>
|
273
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">valor_energetico</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">another</span>.<span class="ruby-identifier">valor_energetico</span>
|
274
|
+
<span class="ruby-keyword">end</span></pre>
|
275
|
+
</div>
|
276
|
+
|
277
|
+
</div>
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
</div>
|
283
|
+
|
284
|
+
|
285
|
+
<div id="method-i-aibc" class="method-detail ">
|
286
|
+
|
287
|
+
<div class="method-heading">
|
288
|
+
<span class="method-name">aibc</span><span
|
289
|
+
class="method-args">(indice)</span>
|
290
|
+
|
291
|
+
<span class="method-click-advice">click to toggle source</span>
|
292
|
+
|
293
|
+
</div>
|
294
|
+
|
295
|
+
|
296
|
+
<div class="method-description">
|
297
|
+
|
298
|
+
<p>Funcion para calcular el AIBC de forma funcional.</p>
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
<div class="method-source-code" id="aibc-source">
|
304
|
+
<pre><span class="ruby-comment"># File lib/food/food_.rb, line 43</span>
|
305
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">aibc</span>(<span class="ruby-identifier">indice</span>)
|
306
|
+
<span class="ruby-identifier">vector</span> = []
|
307
|
+
<span class="ruby-identifier">datos</span>[<span class="ruby-identifier">indice</span>][<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-identifier">datos</span>[<span class="ruby-identifier">indice</span>].<span class="ruby-identifier">length</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>].<span class="ruby-identifier">zip</span>(<span class="ruby-identifier">datos</span>[<span class="ruby-identifier">indice</span>][<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-identifier">datos</span>[<span class="ruby-identifier">indice</span>].<span class="ruby-identifier">length</span><span class="ruby-operator">-</span><span class="ruby-value">2</span>]) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">gi</span>, <span class="ruby-identifier">gi_1</span> <span class="ruby-operator">|</span>
|
308
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">gi</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">datos</span>[<span class="ruby-identifier">indice</span>][<span class="ruby-value">0</span>]
|
309
|
+
<span class="ruby-identifier">vector</span> <span class="ruby-operator"><<</span> <span class="ruby-value">0.0</span>
|
310
|
+
<span class="ruby-keyword">else</span>
|
311
|
+
<span class="ruby-identifier">vector</span> <span class="ruby-operator"><<</span> (((<span class="ruby-identifier">gi</span><span class="ruby-operator">-</span><span class="ruby-identifier">datos</span>[<span class="ruby-identifier">indice</span>][<span class="ruby-value">0</span>])<span class="ruby-operator">+</span>(<span class="ruby-identifier">gi_1</span><span class="ruby-operator">-</span><span class="ruby-identifier">datos</span>[<span class="ruby-identifier">indice</span>][<span class="ruby-value">0</span>]))<span class="ruby-operator">/</span><span class="ruby-value">2</span>)<span class="ruby-operator">*</span><span class="ruby-value">5</span>
|
312
|
+
<span class="ruby-keyword">end</span>
|
313
|
+
<span class="ruby-keyword">end</span>
|
314
|
+
<span class="ruby-identifier">vector</span>.<span class="ruby-identifier">reduce</span>(<span class="ruby-value">:+</span>)
|
315
|
+
<span class="ruby-keyword">end</span></pre>
|
316
|
+
</div>
|
317
|
+
|
318
|
+
</div>
|
319
|
+
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
</div>
|
324
|
+
|
325
|
+
|
326
|
+
<div id="method-i-to_s" class="method-detail ">
|
327
|
+
|
328
|
+
<div class="method-heading">
|
329
|
+
<span class="method-name">to_s</span><span
|
330
|
+
class="method-args">()</span>
|
331
|
+
|
332
|
+
<span class="method-click-advice">click to toggle source</span>
|
333
|
+
|
334
|
+
</div>
|
335
|
+
|
336
|
+
|
337
|
+
<div class="method-description">
|
338
|
+
|
339
|
+
<p>Metodo para mostrar formateado:</p>
|
340
|
+
|
341
|
+
<pre>=>formato= Nombre del alimento nºproteinas nºglucido nºlipidos</pre>
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
<div class="method-source-code" id="to_s-source">
|
347
|
+
<pre><span class="ruby-comment"># File lib/food/food_.rb, line 26</span>
|
348
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">to_s</span>
|
349
|
+
<span class="ruby-node">"#{@nombre}\t#{@proteinas}\t#{@glucidos}\t#{@lipidos}"</span>
|
350
|
+
<span class="ruby-keyword">end</span></pre>
|
351
|
+
</div>
|
352
|
+
|
353
|
+
</div>
|
354
|
+
|
355
|
+
|
356
|
+
|
357
|
+
|
358
|
+
</div>
|
359
|
+
|
360
|
+
|
361
|
+
<div id="method-i-valor_energetico" class="method-detail ">
|
362
|
+
|
363
|
+
<div class="method-heading">
|
364
|
+
<span class="method-name">valor_energetico</span><span
|
365
|
+
class="method-args">()</span>
|
366
|
+
|
367
|
+
<span class="method-click-advice">click to toggle source</span>
|
368
|
+
|
369
|
+
</div>
|
370
|
+
|
371
|
+
|
372
|
+
<div class="method-description">
|
373
|
+
|
374
|
+
<p>Metodo para calcular el valor energético de un alimento:</p>
|
375
|
+
|
376
|
+
<pre>=>Valor energetico=proteinas*4+glucidos*4+lipidos*9.</pre>
|
377
|
+
|
378
|
+
|
379
|
+
|
380
|
+
|
381
|
+
<div class="method-source-code" id="valor_energetico-source">
|
382
|
+
<pre><span class="ruby-comment"># File lib/food/food_.rb, line 32</span>
|
383
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">valor_energetico</span>
|
384
|
+
(<span class="ruby-ivar">@proteinas</span><span class="ruby-operator">*</span><span class="ruby-value">4</span>) <span class="ruby-operator">+</span> (<span class="ruby-ivar">@glucidos</span><span class="ruby-operator">*</span><span class="ruby-value">4</span>) <span class="ruby-operator">+</span> (<span class="ruby-ivar">@lipidos</span><span class="ruby-operator">*</span><span class="ruby-value">9</span>)
|
385
|
+
<span class="ruby-keyword">end</span></pre>
|
386
|
+
</div>
|
387
|
+
|
388
|
+
</div>
|
389
|
+
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
</div>
|
394
|
+
|
395
|
+
|
396
|
+
</section>
|
397
|
+
|
398
|
+
</section>
|
399
|
+
</main>
|
400
|
+
|
401
|
+
|
402
|
+
<footer id="validator-badges" role="contentinfo">
|
403
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
404
|
+
<p>Generated by <a href="https://rdoc.github.io/rdoc">RDoc</a> 5.1.0.
|
405
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
406
|
+
</footer>
|
407
|
+
|