alimento-0100905144 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +2 -0
- data/.gitignore +12 -0
- data/.travis.yml +6 -0
- data/Gemfile +10 -0
- data/Guardfile +82 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +6 -0
- data/alimento.gemspec +40 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/docs/Alimento.html +133 -0
- data/docs/Alimento/Alimento.html +347 -0
- data/docs/Alimento/GrupoAlimento.html +236 -0
- data/docs/Alimento/Lista.html +410 -0
- data/docs/Gemfile.html +102 -0
- data/docs/Gemfile_lock.html +177 -0
- data/docs/Guardfile.html +179 -0
- data/docs/LICENSE_txt.html +116 -0
- data/docs/README_md.html +159 -0
- data/docs/Rakefile.html +100 -0
- data/docs/alimento_gemspec.html +134 -0
- data/docs/bin/setup.html +100 -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/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 +151 -0
- data/lib/alimento.rb +8 -0
- data/lib/alimento/alimento.rb +97 -0
- data/lib/alimento/lista.rb +69 -0
- data/lib/alimento/ordenacion.rb +42 -0
- data/lib/alimento/plato.rb +133 -0
- data/lib/alimento/version.rb +3 -0
- metadata +218 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: fbc26d6f7996dffe2160e4a12385ccce561a9524
|
4
|
+
data.tar.gz: 0fd9620dfac1d3452a2f1373c68a8a466b7c40fb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f99b942a92df60ac13ab6e5d0e85ea0f0ccf72bca2d503821f23668a5793dcfbd7e1b0c55f5da0bd460c41206cfa04718d7a5a3fdd1f840087e50ee7db1f85c6
|
7
|
+
data.tar.gz: b108fba2ebdf56109b20855a0b1d4bc64f047be1fdcfca14dbdabc407a9e081c74f148c81c3fd44d4a59660e737116f7fa52c07b214b02c9864964091ecbae9d
|
data/.coveralls.yml
ADDED
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/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Mireia Scholz
|
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,39 @@
|
|
1
|
+
# Alimento
|
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/alimento`. 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 'alimento'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install alimento
|
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]/alimento.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/alimento.gemspec
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "alimento/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "alimento-0100905144"
|
8
|
+
spec.version = Alimento::VERSION
|
9
|
+
spec.authors = ["Mireia Scholz"]
|
10
|
+
spec.email = ["alu0100905144@ull.edu.es"]
|
11
|
+
|
12
|
+
spec.summary = %q{Desarrollo de la clase Alimento usando TDD.}
|
13
|
+
spec.description = %q{Desarrollo de la clase Alimento para calcular su valor energético usando TDD.}
|
14
|
+
spec.homepage = "https://github.com/ULL-ESIT-LPP-1718/tdd-alu0100905144.git"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
if spec.respond_to?(:metadata)
|
18
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
19
|
+
else
|
20
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
21
|
+
"public gem pushes."
|
22
|
+
end
|
23
|
+
|
24
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
25
|
+
f.match(%r{^(test|spec|features)/})
|
26
|
+
end
|
27
|
+
spec.bindir = "exe"
|
28
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
29
|
+
spec.require_paths = ["lib"]
|
30
|
+
|
31
|
+
spec.add_development_dependency "bundler", "~> 1.15"
|
32
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
33
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
34
|
+
spec.add_development_dependency "guard"
|
35
|
+
spec.add_development_dependency "guard-rspec"
|
36
|
+
spec.add_development_dependency "guard-bundler"
|
37
|
+
spec.add_development_dependency "coveralls"
|
38
|
+
|
39
|
+
|
40
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "alimento"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/docs/Alimento.html
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>module 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="module">
|
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
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
</div>
|
63
|
+
</nav>
|
64
|
+
|
65
|
+
<main role="main" aria-labelledby="module-Alimento">
|
66
|
+
<h1 id="module-Alimento" class="module">
|
67
|
+
module Alimento
|
68
|
+
</h1>
|
69
|
+
|
70
|
+
<section class="description">
|
71
|
+
|
72
|
+
<p>Este módulo se ha creado para la asignatura Lenguajes y Paradigmas de la
|
73
|
+
Programación para aprender a utilizar las diferentes herramientas de las
|
74
|
+
que dispone Ruby. Contiene las clases <a
|
75
|
+
href="Alimento/Alimento.html">Alimento</a>, <a
|
76
|
+
href="Alimento/GrupoAlimento.html">GrupoAlimento</a>, <a
|
77
|
+
href="Alimento.html#Nodo">Nodo</a> y <a
|
78
|
+
href="Alimento/Lista.html">Lista</a>.</p>
|
79
|
+
<dl class="rdoc-list note-list"><dt>Author
|
80
|
+
<dd>
|
81
|
+
<p>Mireia Scholz (alu0100905144@ull.edu.es)</p>
|
82
|
+
</dd><dt>Copyright
|
83
|
+
<dd>
|
84
|
+
<p>Cretive Commons</p>
|
85
|
+
</dd><dt>License
|
86
|
+
<dd>
|
87
|
+
<p>Distributes under the same terms as Ruby</p>
|
88
|
+
</dd></dl>
|
89
|
+
|
90
|
+
</section>
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
<section class="constants-list">
|
102
|
+
<header>
|
103
|
+
<h3>Constants</h3>
|
104
|
+
</header>
|
105
|
+
<dl>
|
106
|
+
|
107
|
+
<dt id="Nodo">Nodo
|
108
|
+
|
109
|
+
<dd><p>Esta clase representa el nodo de una lista.</p>
|
110
|
+
|
111
|
+
|
112
|
+
<dt id="VERSION">VERSION
|
113
|
+
|
114
|
+
<dd>
|
115
|
+
|
116
|
+
|
117
|
+
</dl>
|
118
|
+
</section>
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
</section>
|
125
|
+
</main>
|
126
|
+
|
127
|
+
|
128
|
+
<footer id="validator-badges" role="contentinfo">
|
129
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
130
|
+
<p>Generated by <a href="https://rdoc.github.io/rdoc">RDoc</a> 5.1.0.
|
131
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
132
|
+
</footer>
|
133
|
+
|
@@ -0,0 +1,347 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class Alimento::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">Object
|
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-to_s">#to_s</a>
|
90
|
+
|
91
|
+
<li ><a href="#method-i-valor_energetico">#valor_energetico</a>
|
92
|
+
|
93
|
+
</ul>
|
94
|
+
</div>
|
95
|
+
|
96
|
+
</div>
|
97
|
+
</nav>
|
98
|
+
|
99
|
+
<main role="main" aria-labelledby="class-Alimento::Alimento">
|
100
|
+
<h1 id="class-Alimento::Alimento" class="class">
|
101
|
+
class Alimento::Alimento
|
102
|
+
</h1>
|
103
|
+
|
104
|
+
<section class="description">
|
105
|
+
|
106
|
+
<p>Esta clase permite representar un alimento y calcular su valor energético.</p>
|
107
|
+
|
108
|
+
</section>
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
<section class="attribute-method-details" class="method-section">
|
122
|
+
<header>
|
123
|
+
<h3>Attributes</h3>
|
124
|
+
</header>
|
125
|
+
|
126
|
+
|
127
|
+
<div id="attribute-i-glucidos" class="method-detail">
|
128
|
+
<div class="method-heading attribute-method-heading">
|
129
|
+
<span class="method-name">glucidos</span><span
|
130
|
+
class="attribute-access-type">[R]</span>
|
131
|
+
</div>
|
132
|
+
|
133
|
+
<div class="method-description">
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
</div>
|
138
|
+
</div>
|
139
|
+
|
140
|
+
<div id="attribute-i-lipidos" class="method-detail">
|
141
|
+
<div class="method-heading attribute-method-heading">
|
142
|
+
<span class="method-name">lipidos</span><span
|
143
|
+
class="attribute-access-type">[R]</span>
|
144
|
+
</div>
|
145
|
+
|
146
|
+
<div class="method-description">
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
</div>
|
151
|
+
</div>
|
152
|
+
|
153
|
+
<div id="attribute-i-nombre" class="method-detail">
|
154
|
+
<div class="method-heading attribute-method-heading">
|
155
|
+
<span class="method-name">nombre</span><span
|
156
|
+
class="attribute-access-type">[R]</span>
|
157
|
+
</div>
|
158
|
+
|
159
|
+
<div class="method-description">
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
</div>
|
164
|
+
</div>
|
165
|
+
|
166
|
+
<div id="attribute-i-proteinas" class="method-detail">
|
167
|
+
<div class="method-heading attribute-method-heading">
|
168
|
+
<span class="method-name">proteinas</span><span
|
169
|
+
class="attribute-access-type">[R]</span>
|
170
|
+
</div>
|
171
|
+
|
172
|
+
<div class="method-description">
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
</div>
|
177
|
+
</div>
|
178
|
+
|
179
|
+
</section>
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
184
|
+
<header>
|
185
|
+
<h3>Public Class Methods</h3>
|
186
|
+
</header>
|
187
|
+
|
188
|
+
|
189
|
+
<div id="method-c-new" class="method-detail ">
|
190
|
+
|
191
|
+
<div class="method-heading">
|
192
|
+
<span class="method-name">new</span><span
|
193
|
+
class="method-args">(nombre, proteinas, glucidos, lipidos)</span>
|
194
|
+
|
195
|
+
<span class="method-click-advice">click to toggle source</span>
|
196
|
+
|
197
|
+
</div>
|
198
|
+
|
199
|
+
|
200
|
+
<div class="method-description">
|
201
|
+
|
202
|
+
<p>Se asignan el nombre y los valores gramos de proteínas, glúcidos y lípidos
|
203
|
+
al alimento.</p>
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
<div class="method-source-code" id="new-source">
|
209
|
+
<pre><span class="ruby-comment"># File lib/alimento/alimento.rb, line 18</span>
|
210
|
+
<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">glucidos</span>, <span class="ruby-identifier">lipidos</span>)
|
211
|
+
<span class="ruby-ivar">@nombre</span> = <span class="ruby-identifier">nombre</span>
|
212
|
+
<span class="ruby-ivar">@proteinas</span> = <span class="ruby-identifier">proteinas</span>
|
213
|
+
<span class="ruby-ivar">@glucidos</span> = <span class="ruby-identifier">glucidos</span>
|
214
|
+
<span class="ruby-ivar">@lipidos</span> = <span class="ruby-identifier">lipidos</span>
|
215
|
+
<span class="ruby-keyword">end</span></pre>
|
216
|
+
</div>
|
217
|
+
|
218
|
+
</div>
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
</div>
|
224
|
+
|
225
|
+
|
226
|
+
</section>
|
227
|
+
|
228
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
229
|
+
<header>
|
230
|
+
<h3>Public Instance Methods</h3>
|
231
|
+
</header>
|
232
|
+
|
233
|
+
|
234
|
+
<div id="method-i-3C-3D-3E" class="method-detail ">
|
235
|
+
|
236
|
+
<div class="method-heading">
|
237
|
+
<span class="method-name"><=></span><span
|
238
|
+
class="method-args">(other)</span>
|
239
|
+
|
240
|
+
<span class="method-click-advice">click to toggle source</span>
|
241
|
+
|
242
|
+
</div>
|
243
|
+
|
244
|
+
|
245
|
+
<div class="method-description">
|
246
|
+
|
247
|
+
<p>Se define para incluir el mixin comparable. Se toma como valor para la
|
248
|
+
comparación el nombre del alimento.</p>
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
<div class="method-source-code" id="3C-3D-3E-source">
|
254
|
+
<pre><span class="ruby-comment"># File lib/alimento/alimento.rb, line 37</span>
|
255
|
+
<span class="ruby-keyword">def</span> <span class="ruby-operator"><=></span>(<span class="ruby-identifier">other</span>)
|
256
|
+
<span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">instance_of?</span><span class="ruby-constant">Alimento</span>
|
257
|
+
<span class="ruby-ivar">@nombre</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">nombre</span>
|
258
|
+
<span class="ruby-keyword">end</span></pre>
|
259
|
+
</div>
|
260
|
+
|
261
|
+
</div>
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
</div>
|
267
|
+
|
268
|
+
|
269
|
+
<div id="method-i-to_s" class="method-detail ">
|
270
|
+
|
271
|
+
<div class="method-heading">
|
272
|
+
<span class="method-name">to_s</span><span
|
273
|
+
class="method-args">()</span>
|
274
|
+
|
275
|
+
<span class="method-click-advice">click to toggle source</span>
|
276
|
+
|
277
|
+
</div>
|
278
|
+
|
279
|
+
|
280
|
+
<div class="method-description">
|
281
|
+
|
282
|
+
<p>Permite visualizar el alimento formateado.</p>
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
<div class="method-source-code" id="to_s-source">
|
288
|
+
<pre><span class="ruby-comment"># File lib/alimento/alimento.rb, line 26</span>
|
289
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">to_s</span>
|
290
|
+
<span class="ruby-keyword">return</span> <span class="ruby-node">%Q(#{@nombre.capitalize}: #{@proteinas}gr de proteínas, #{@glucidos}gr de hidratos de carbono y #{@lipidos}g de grasas)</span>
|
291
|
+
<span class="ruby-keyword">end</span></pre>
|
292
|
+
</div>
|
293
|
+
|
294
|
+
</div>
|
295
|
+
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
</div>
|
300
|
+
|
301
|
+
|
302
|
+
<div id="method-i-valor_energetico" class="method-detail ">
|
303
|
+
|
304
|
+
<div class="method-heading">
|
305
|
+
<span class="method-name">valor_energetico</span><span
|
306
|
+
class="method-args">()</span>
|
307
|
+
|
308
|
+
<span class="method-click-advice">click to toggle source</span>
|
309
|
+
|
310
|
+
</div>
|
311
|
+
|
312
|
+
|
313
|
+
<div class="method-description">
|
314
|
+
|
315
|
+
<p>Calcula el valor energético del alimento a partir de los gramos de
|
316
|
+
proteínas, glúcidos y lípidos.</p>
|
317
|
+
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
<div class="method-source-code" id="valor_energetico-source">
|
322
|
+
<pre><span class="ruby-comment"># File lib/alimento/alimento.rb, line 31</span>
|
323
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">valor_energetico</span>
|
324
|
+
(<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>)
|
325
|
+
<span class="ruby-keyword">end</span></pre>
|
326
|
+
</div>
|
327
|
+
|
328
|
+
</div>
|
329
|
+
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
</div>
|
334
|
+
|
335
|
+
|
336
|
+
</section>
|
337
|
+
|
338
|
+
</section>
|
339
|
+
</main>
|
340
|
+
|
341
|
+
|
342
|
+
<footer id="validator-badges" role="contentinfo">
|
343
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
344
|
+
<p>Generated by <a href="https://rdoc.github.io/rdoc">RDoc</a> 5.1.0.
|
345
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
346
|
+
</footer>
|
347
|
+
|