tddAlimentos 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 +2 -0
- data/.gitignore +13 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +101 -0
- data/Guardfile +83 -0
- data/README.md +46 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/docs/Alimento.html +428 -0
- data/docs/Gemfile.html +98 -0
- data/docs/Gemfile_lock.html +183 -0
- data/docs/Guardfile.html +166 -0
- data/docs/List.html +682 -0
- data/docs/Object.html +128 -0
- data/docs/Plato.html +607 -0
- data/docs/PlatoAmbiental.html +492 -0
- data/docs/README_md.html +126 -0
- data/docs/Rakefile.html +100 -0
- data/docs/TddAlimentos.html +110 -0
- data/docs/TddAlimentos/Error.html +103 -0
- data/docs/bin/setup.html +100 -0
- data/docs/created.rid +17 -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 +117 -0
- data/docs/js/darkfish.js +161 -0
- data/docs/js/jquery.js +4 -0
- data/docs/js/navigation.js +141 -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 +307 -0
- data/docs/tddAlimentos_gemspec.html +133 -0
- data/lib/tddAlimentos.rb +12 -0
- data/lib/tddAlimentos/alimento.rb +56 -0
- data/lib/tddAlimentos/lista.rb +172 -0
- data/lib/tddAlimentos/menu.rb +51 -0
- data/lib/tddAlimentos/plato.rb +125 -0
- data/lib/tddAlimentos/platoAmbiental.rb +108 -0
- data/lib/tddAlimentos/platoDSL.rb +94 -0
- data/lib/tddAlimentos/version.rb +3 -0
- data/tddAlimentos.gemspec +39 -0
- metadata +249 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 313ac9921ab0674d603a410a29d5cf74fb29ea0cd55acb022ea0885d1139f53d
|
4
|
+
data.tar.gz: fea4c81cd2cb6e6c179aa0adc2d9cb8fbe5495f314821034ec146144e9ae828a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 90c0e95a06b41ca614e0ede0ea0bbfa399a86132b1cbca91fcee1d0372cf9a36a35f7212d4d3216f1e97de63a270292207ba0f6aed495b7998b7c09887c59fd1
|
7
|
+
data.tar.gz: ae8bb64a050b15f5d33882dc37668d1385cd2345dcc618db449ac42ad80309a82d37041fd6421118cb02af03cf1e556346e3bece858c3219565351332678b98f
|
data/.coveralls.yml
ADDED
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
tddAlimentos (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
coderay (1.1.2)
|
10
|
+
coveralls (0.8.23)
|
11
|
+
json (>= 1.8, < 3)
|
12
|
+
simplecov (~> 0.16.1)
|
13
|
+
term-ansicolor (~> 1.3)
|
14
|
+
thor (>= 0.19.4, < 2.0)
|
15
|
+
tins (~> 1.6)
|
16
|
+
diff-lcs (1.3)
|
17
|
+
docile (1.3.2)
|
18
|
+
ffi (1.11.2)
|
19
|
+
formatador (0.2.5)
|
20
|
+
guard (2.16.1)
|
21
|
+
formatador (>= 0.2.4)
|
22
|
+
listen (>= 2.7, < 4.0)
|
23
|
+
lumberjack (>= 1.0.12, < 2.0)
|
24
|
+
nenv (~> 0.1)
|
25
|
+
notiffany (~> 0.0)
|
26
|
+
pry (>= 0.9.12)
|
27
|
+
shellany (~> 0.0)
|
28
|
+
thor (>= 0.18.1)
|
29
|
+
guard-bundler (2.2.1)
|
30
|
+
bundler (>= 1.3.0, < 3)
|
31
|
+
guard (~> 2.2)
|
32
|
+
guard-compat (~> 1.1)
|
33
|
+
guard-compat (1.2.1)
|
34
|
+
guard-rspec (4.7.3)
|
35
|
+
guard (~> 2.1)
|
36
|
+
guard-compat (~> 1.1)
|
37
|
+
rspec (>= 2.99.0, < 4.0)
|
38
|
+
json (2.3.0)
|
39
|
+
listen (3.2.0)
|
40
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
41
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
42
|
+
lumberjack (1.0.13)
|
43
|
+
markup (0.1.3)
|
44
|
+
rdiscount (>= 1.3.5)
|
45
|
+
method_source (0.9.2)
|
46
|
+
nenv (0.3.0)
|
47
|
+
notiffany (0.1.3)
|
48
|
+
nenv (~> 0.1)
|
49
|
+
shellany (~> 0.0)
|
50
|
+
pry (0.12.2)
|
51
|
+
coderay (~> 1.1.0)
|
52
|
+
method_source (~> 0.9.0)
|
53
|
+
rake (10.5.0)
|
54
|
+
rb-fsevent (0.10.3)
|
55
|
+
rb-inotify (0.10.0)
|
56
|
+
ffi (~> 1.0)
|
57
|
+
rdiscount (2.2.0.1)
|
58
|
+
rdoc (6.1.0)
|
59
|
+
rspec (3.9.0)
|
60
|
+
rspec-core (~> 3.9.0)
|
61
|
+
rspec-expectations (~> 3.9.0)
|
62
|
+
rspec-mocks (~> 3.9.0)
|
63
|
+
rspec-core (3.9.0)
|
64
|
+
rspec-support (~> 3.9.0)
|
65
|
+
rspec-expectations (3.9.0)
|
66
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
67
|
+
rspec-support (~> 3.9.0)
|
68
|
+
rspec-mocks (3.9.0)
|
69
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
70
|
+
rspec-support (~> 3.9.0)
|
71
|
+
rspec-support (3.9.0)
|
72
|
+
shellany (0.0.1)
|
73
|
+
simplecov (0.16.1)
|
74
|
+
docile (~> 1.1)
|
75
|
+
json (>= 1.8, < 3)
|
76
|
+
simplecov-html (~> 0.10.0)
|
77
|
+
simplecov-html (0.10.2)
|
78
|
+
sync (0.5.0)
|
79
|
+
term-ansicolor (1.7.1)
|
80
|
+
tins (~> 1.0)
|
81
|
+
thor (0.20.3)
|
82
|
+
tins (1.23.0)
|
83
|
+
sync
|
84
|
+
|
85
|
+
PLATFORMS
|
86
|
+
ruby
|
87
|
+
|
88
|
+
DEPENDENCIES
|
89
|
+
bundler (~> 2.0)
|
90
|
+
coveralls
|
91
|
+
guard
|
92
|
+
guard-bundler
|
93
|
+
guard-rspec
|
94
|
+
markup
|
95
|
+
rake (~> 10.0)
|
96
|
+
rdoc
|
97
|
+
rspec (~> 3.0)
|
98
|
+
tddAlimentos!
|
99
|
+
|
100
|
+
BUNDLED WITH
|
101
|
+
2.1.4
|
data/Guardfile
ADDED
@@ -0,0 +1,83 @@
|
|
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.exist?(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
|
+
watch(%r{^lib/tddAlimentos/(.+)\.rb$}) { dsl.rspec.spec_dir }
|
45
|
+
|
46
|
+
# RSpec files
|
47
|
+
rspec = dsl.rspec
|
48
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
49
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
50
|
+
watch(rspec.spec_files)
|
51
|
+
|
52
|
+
# Ruby files
|
53
|
+
ruby = dsl.ruby
|
54
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
55
|
+
|
56
|
+
# Rails files
|
57
|
+
rails = dsl.rails(view_extensions: %w(erb haml slim))
|
58
|
+
dsl.watch_spec_files_for(rails.app_files)
|
59
|
+
dsl.watch_spec_files_for(rails.views)
|
60
|
+
|
61
|
+
watch(rails.controllers) do |m|
|
62
|
+
[
|
63
|
+
rspec.spec.call("routing/#{m[1]}_routing"),
|
64
|
+
rspec.spec.call("controllers/#{m[1]}_controller"),
|
65
|
+
rspec.spec.call("acceptance/#{m[1]}")
|
66
|
+
]
|
67
|
+
end
|
68
|
+
|
69
|
+
# Rails config changes
|
70
|
+
watch(rails.spec_helper) { rspec.spec_dir }
|
71
|
+
watch(rails.routes) { "#{rspec.spec_dir}/routing" }
|
72
|
+
watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
|
73
|
+
|
74
|
+
# Capybara features specs
|
75
|
+
watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
|
76
|
+
watch(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") }
|
77
|
+
|
78
|
+
# Turnip features and steps
|
79
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
80
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
|
81
|
+
Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
|
82
|
+
end
|
83
|
+
end
|
data/README.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# Práctica 10: Lenguajes de Dominio Específico (DSL - Domain Specific Languages)
|
2
|
+
En esta práctica vamos a diseñar e implementar una DSL que nos permita una mejor definición de menús dietéticos diarios y semanales.
|
3
|
+
|
4
|
+
[](https://coveralls.io/github/alu0101119373/pract10?branch=master)
|
5
|
+
|
6
|
+
## Instalación
|
7
|
+
|
8
|
+
En la carpeta del proyecto, ejecutar:
|
9
|
+
|
10
|
+
`bundle install`
|
11
|
+
|
12
|
+
## Metodología
|
13
|
+
Para el desarrollo de esta práctica, crearemos una clase Menú y modificaremos las clases Alimento y Plato para que permitan el uso de una DSL. De esta manera, crear un menú será tan sencillo como hacer lo siguiente:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
plato = Plato.new ("Hamburguesa") do
|
17
|
+
nombre "Hamburguesa especial de la casa"
|
18
|
+
alimento :descripcion => "carne de vaca",
|
19
|
+
:gramos => 100
|
20
|
+
alimento :descripcion => "huevo",
|
21
|
+
:gramos => 20
|
22
|
+
end
|
23
|
+
|
24
|
+
menu = Menu.new ("Combinado nº. 1") do
|
25
|
+
descripcion "hamburguesa, papas, refresco"
|
26
|
+
componente :descripcion => "Hamburguesa especial de la casa",
|
27
|
+
:precio => 4.25
|
28
|
+
componente :descripcion => "Papas pequeñas",
|
29
|
+
:precio => 1.75
|
30
|
+
componente :descripcion => "Refresco de lata",
|
31
|
+
:precio => 1.5
|
32
|
+
precio 7.5
|
33
|
+
end
|
34
|
+
```
|
35
|
+
|
36
|
+
## Datos del creador
|
37
|
+
* **Autor:** Himar Manuel Barquín Carrasco.
|
38
|
+
* **Fecha de creación:** 06/01/2020.
|
39
|
+
* **Fecha de entrega:** 08/01/2020.
|
40
|
+
|
41
|
+
|
42
|
+
------------
|
43
|
+
|
44
|
+
*Lenguajes y Paradigmas de Programación, Ingeniería Informática*.
|
45
|
+
|
46
|
+
*Escuela Superior de Ingeniería y Tecnología, Universidad de La Laguna*.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "tddAlimentos"
|
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,428 @@
|
|
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
|
+
|
23
|
+
<body id="top" role="document" class="class">
|
24
|
+
<nav role="navigation">
|
25
|
+
<div id="project-navigation">
|
26
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
27
|
+
<h2>
|
28
|
+
<a href="./index.html" rel="home">Home</a>
|
29
|
+
</h2>
|
30
|
+
|
31
|
+
<div id="table-of-contents-navigation">
|
32
|
+
<a href="./table_of_contents.html#pages">Pages</a>
|
33
|
+
<a href="./table_of_contents.html#classes">Classes</a>
|
34
|
+
<a href="./table_of_contents.html#methods">Methods</a>
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
39
|
+
<form action="#" method="get" accept-charset="utf-8">
|
40
|
+
<div id="search-field-wrapper">
|
41
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
42
|
+
aria-autocomplete="list" aria-controls="search-results"
|
43
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
44
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
45
|
+
</div>
|
46
|
+
|
47
|
+
<ul id="search-results" aria-label="Search Results"
|
48
|
+
aria-busy="false" aria-expanded="false"
|
49
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
50
|
+
</form>
|
51
|
+
</div>
|
52
|
+
|
53
|
+
</div>
|
54
|
+
|
55
|
+
|
56
|
+
<div class="nav-section">
|
57
|
+
<h3>Table of Contents</h3>
|
58
|
+
|
59
|
+
<ul class="link-list" role="directory">
|
60
|
+
<li><a href="#class-Alimento-label-alimento.rb">alimento.rb</a>
|
61
|
+
<li><a href="#class-Alimento-label-Descripci-C3-B3n">Descripción</a>
|
62
|
+
<li><a href="#class-Alimento-label-M-C3-A9todos">Métodos</a>
|
63
|
+
</ul>
|
64
|
+
</div>
|
65
|
+
|
66
|
+
|
67
|
+
<div id="class-metadata">
|
68
|
+
|
69
|
+
<div id="parent-class-section" class="nav-section">
|
70
|
+
<h3>Parent</h3>
|
71
|
+
|
72
|
+
|
73
|
+
<p class="link"><a href="Object.html">Object</a>
|
74
|
+
|
75
|
+
</div>
|
76
|
+
|
77
|
+
<div id="includes-section" class="nav-section">
|
78
|
+
<h3>Included Modules</h3>
|
79
|
+
|
80
|
+
<ul class="link-list">
|
81
|
+
|
82
|
+
|
83
|
+
<li><span class="include">Comparable</span>
|
84
|
+
|
85
|
+
|
86
|
+
</ul>
|
87
|
+
</div>
|
88
|
+
|
89
|
+
|
90
|
+
<!-- Method Quickref -->
|
91
|
+
<div id="method-list-section" class="nav-section">
|
92
|
+
<h3>Methods</h3>
|
93
|
+
|
94
|
+
<ul class="link-list" role="directory">
|
95
|
+
|
96
|
+
<li ><a href="#method-c-new">::new</a>
|
97
|
+
|
98
|
+
<li ><a href="#method-i-3C-3D-3E">#<=></a>
|
99
|
+
|
100
|
+
<li ><a href="#method-i-energetic_value">#energetic_value</a>
|
101
|
+
|
102
|
+
<li ><a href="#method-i-to_s">#to_s</a>
|
103
|
+
|
104
|
+
</ul>
|
105
|
+
</div>
|
106
|
+
|
107
|
+
</div>
|
108
|
+
</nav>
|
109
|
+
|
110
|
+
<main role="main" aria-labelledby="class-Alimento">
|
111
|
+
<h1 id="class-Alimento" class="class">
|
112
|
+
class Alimento
|
113
|
+
</h1>
|
114
|
+
|
115
|
+
<section class="description">
|
116
|
+
|
117
|
+
<h1 id="class-Alimento-label-alimento.rb">alimento.rb<span><a href="#class-Alimento-label-alimento.rb">¶</a> <a href="#top">↑</a></span></h1>
|
118
|
+
<dl class="rdoc-list note-list"><dt>Autor
|
119
|
+
<dd>
|
120
|
+
<p>Himar Manuel Barquín Carrasco</p>
|
121
|
+
</dd><dt>Web
|
122
|
+
<dd>
|
123
|
+
<p><a href="https://github.com/ULL-ESIT-LPP-1920/tdd-alu0101119373">github.com/ULL-ESIT-LPP-1920/tdd-alu0101119373</a></p>
|
124
|
+
</dd></dl>
|
125
|
+
|
126
|
+
<h2 id="class-Alimento-label-Descripci-C3-B3n">Descripción<span><a href="#class-Alimento-label-Descripci-C3-B3n">¶</a> <a href="#top">↑</a></span></h2>
|
127
|
+
|
128
|
+
<p>Clase que representa un alimento, con la información de las proteínas, carbohidratos, lípidos, gases de efecto invernadero y metros cuadrados de tierra consumida que provoca producir el alimento.</p>
|
129
|
+
|
130
|
+
<h2 id="class-Alimento-label-M-C3-A9todos">Métodos<span><a href="#class-Alimento-label-M-C3-A9todos">¶</a> <a href="#top">↑</a></span></h2>
|
131
|
+
<ul><li>
|
132
|
+
<p><a href="Alimento.html#method-i-to_s"><code>to_s</code></a></p>
|
133
|
+
</li><li>
|
134
|
+
<p><a href="Alimento.html#method-i-energetic_value"><code>energetic_value</code></a></p>
|
135
|
+
</li><li>
|
136
|
+
<p><=></p>
|
137
|
+
</li></ul>
|
138
|
+
|
139
|
+
</section>
|
140
|
+
|
141
|
+
|
142
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
<section class="attribute-method-details" class="method-section">
|
151
|
+
<header>
|
152
|
+
<h3>Attributes</h3>
|
153
|
+
</header>
|
154
|
+
|
155
|
+
|
156
|
+
<div id="attribute-i-carbohydrates" class="method-detail">
|
157
|
+
<div class="method-heading attribute-method-heading">
|
158
|
+
<span class="method-name">carbohydrates</span><span
|
159
|
+
class="attribute-access-type">[R]</span>
|
160
|
+
</div>
|
161
|
+
|
162
|
+
<div class="method-description">
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
</div>
|
167
|
+
</div>
|
168
|
+
|
169
|
+
<div id="attribute-i-gei" class="method-detail">
|
170
|
+
<div class="method-heading attribute-method-heading">
|
171
|
+
<span class="method-name">gei</span><span
|
172
|
+
class="attribute-access-type">[R]</span>
|
173
|
+
</div>
|
174
|
+
|
175
|
+
<div class="method-description">
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
</div>
|
180
|
+
</div>
|
181
|
+
|
182
|
+
<div id="attribute-i-lipids" class="method-detail">
|
183
|
+
<div class="method-heading attribute-method-heading">
|
184
|
+
<span class="method-name">lipids</span><span
|
185
|
+
class="attribute-access-type">[R]</span>
|
186
|
+
</div>
|
187
|
+
|
188
|
+
<div class="method-description">
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
</div>
|
193
|
+
</div>
|
194
|
+
|
195
|
+
<div id="attribute-i-name" class="method-detail">
|
196
|
+
<div class="method-heading attribute-method-heading">
|
197
|
+
<span class="method-name">name</span><span
|
198
|
+
class="attribute-access-type">[R]</span>
|
199
|
+
</div>
|
200
|
+
|
201
|
+
<div class="method-description">
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
</div>
|
206
|
+
</div>
|
207
|
+
|
208
|
+
<div id="attribute-i-protein" class="method-detail">
|
209
|
+
<div class="method-heading attribute-method-heading">
|
210
|
+
<span class="method-name">protein</span><span
|
211
|
+
class="attribute-access-type">[R]</span>
|
212
|
+
</div>
|
213
|
+
|
214
|
+
<div class="method-description">
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
</div>
|
219
|
+
</div>
|
220
|
+
|
221
|
+
<div id="attribute-i-terrain" class="method-detail">
|
222
|
+
<div class="method-heading attribute-method-heading">
|
223
|
+
<span class="method-name">terrain</span><span
|
224
|
+
class="attribute-access-type">[R]</span>
|
225
|
+
</div>
|
226
|
+
|
227
|
+
<div class="method-description">
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
</div>
|
232
|
+
</div>
|
233
|
+
|
234
|
+
</section>
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
239
|
+
<header>
|
240
|
+
<h3>Public Class Methods</h3>
|
241
|
+
</header>
|
242
|
+
|
243
|
+
|
244
|
+
<div id="method-c-new" class="method-detail ">
|
245
|
+
|
246
|
+
<div class="method-heading">
|
247
|
+
<span class="method-name">new</span><span
|
248
|
+
class="method-args">(name, protein, carbohydrates, lipids, gei, terrain)</span>
|
249
|
+
|
250
|
+
<span class="method-click-advice">click to toggle source</span>
|
251
|
+
|
252
|
+
</div>
|
253
|
+
|
254
|
+
|
255
|
+
<div class="method-description">
|
256
|
+
|
257
|
+
<p>Constructor de la clase <a href="Alimento.html"><code>Alimento</code></a></p>
|
258
|
+
<dl class="rdoc-list note-list"><dt>Parámetros
|
259
|
+
<dd></dd></dl>
|
260
|
+
<ul><li>
|
261
|
+
<p>name: Nombre del alimento</p>
|
262
|
+
</li><li>
|
263
|
+
<p>protein: Proteínas del alimento</p>
|
264
|
+
</li><li>
|
265
|
+
<p>carbohydrates: Carbohidratos del alimento</p>
|
266
|
+
</li><li>
|
267
|
+
<p>lipids: Lípidos del alimento</p>
|
268
|
+
</li><li>
|
269
|
+
<p>gei: Gases de Efecto Invernadero que se producen al producir el alimento</p>
|
270
|
+
</li><li>
|
271
|
+
<p>terrain: Terreno que se usa para la producción del alimento</p>
|
272
|
+
</li></ul>
|
273
|
+
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
<div class="method-source-code" id="new-source">
|
278
|
+
<pre><span class="ruby-comment"># File lib/tddAlimentos/alimento.rb, line 29</span>
|
279
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span> (<span class="ruby-identifier">name</span>, <span class="ruby-identifier">protein</span>, <span class="ruby-identifier">carbohydrates</span>, <span class="ruby-identifier">lipids</span>, <span class="ruby-identifier">gei</span>, <span class="ruby-identifier">terrain</span>)
|
280
|
+
<span class="ruby-ivar">@name</span>, <span class="ruby-ivar">@protein</span>, <span class="ruby-ivar">@carbohydrates</span>, <span class="ruby-ivar">@lipids</span>, <span class="ruby-ivar">@gei</span>, <span class="ruby-ivar">@terrain</span> = <span class="ruby-identifier">name</span>, <span class="ruby-identifier">protein</span>, <span class="ruby-identifier">carbohydrates</span>, <span class="ruby-identifier">lipids</span>, <span class="ruby-identifier">gei</span>, <span class="ruby-identifier">terrain</span>
|
281
|
+
<span class="ruby-keyword">end</span></pre>
|
282
|
+
</div>
|
283
|
+
|
284
|
+
</div>
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
</div>
|
290
|
+
|
291
|
+
|
292
|
+
</section>
|
293
|
+
|
294
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
295
|
+
<header>
|
296
|
+
<h3>Public Instance Methods</h3>
|
297
|
+
</header>
|
298
|
+
|
299
|
+
|
300
|
+
<div id="method-i-3C-3D-3E" class="method-detail ">
|
301
|
+
|
302
|
+
<div class="method-heading">
|
303
|
+
<span class="method-name"><=></span><span
|
304
|
+
class="method-args">(another)</span>
|
305
|
+
|
306
|
+
<span class="method-click-advice">click to toggle source</span>
|
307
|
+
|
308
|
+
</div>
|
309
|
+
|
310
|
+
|
311
|
+
<div class="method-description">
|
312
|
+
|
313
|
+
<p>Nos permite comparar alimentos por su valor energético</p>
|
314
|
+
<dl class="rdoc-list note-list"><dt>Parámetros
|
315
|
+
<dd></dd></dl>
|
316
|
+
<ul><li>
|
317
|
+
<p>another: Otro plato que se compara con el invocante</p>
|
318
|
+
</li></ul>
|
319
|
+
<dl class="rdoc-list note-list"><dt>Devuelve
|
320
|
+
<dd>
|
321
|
+
<p>'true' si la comparación es verdadera. 'false' en otro caso</p>
|
322
|
+
</dd></dl>
|
323
|
+
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
<div class="method-source-code" id="3C-3D-3E-source">
|
328
|
+
<pre><span class="ruby-comment"># File lib/tddAlimentos/alimento.rb, line 52</span>
|
329
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title"><=></span> (<span class="ruby-identifier">another</span>)
|
330
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">energetic_value</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">another</span>.<span class="ruby-identifier">energetic_value</span>
|
331
|
+
<span class="ruby-keyword">end</span></pre>
|
332
|
+
</div>
|
333
|
+
|
334
|
+
</div>
|
335
|
+
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
</div>
|
340
|
+
|
341
|
+
|
342
|
+
<div id="method-i-energetic_value" class="method-detail ">
|
343
|
+
|
344
|
+
<div class="method-heading">
|
345
|
+
<span class="method-name">energetic_value</span><span
|
346
|
+
class="method-args">()</span>
|
347
|
+
|
348
|
+
<span class="method-click-advice">click to toggle source</span>
|
349
|
+
|
350
|
+
</div>
|
351
|
+
|
352
|
+
|
353
|
+
<div class="method-description">
|
354
|
+
|
355
|
+
<p>Calcula el valor energético del alimento</p>
|
356
|
+
<dl class="rdoc-list note-list"><dt>Devuelve
|
357
|
+
<dd>
|
358
|
+
<p>Valor decimal con el valor energético</p>
|
359
|
+
</dd></dl>
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
|
364
|
+
<div class="method-source-code" id="energetic_value-source">
|
365
|
+
<pre><span class="ruby-comment"># File lib/tddAlimentos/alimento.rb, line 43</span>
|
366
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">energetic_value</span>
|
367
|
+
<span class="ruby-value">4</span> <span class="ruby-operator">*</span> <span class="ruby-ivar">@protein</span> <span class="ruby-operator">+</span> <span class="ruby-value">4</span> <span class="ruby-operator">*</span> <span class="ruby-ivar">@carbohydrates</span> <span class="ruby-operator">+</span> <span class="ruby-value">9</span> <span class="ruby-operator">*</span> <span class="ruby-ivar">@lipids</span>
|
368
|
+
<span class="ruby-keyword">end</span></pre>
|
369
|
+
</div>
|
370
|
+
|
371
|
+
</div>
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
|
376
|
+
</div>
|
377
|
+
|
378
|
+
|
379
|
+
<div id="method-i-to_s" class="method-detail ">
|
380
|
+
|
381
|
+
<div class="method-heading">
|
382
|
+
<span class="method-name">to_s</span><span
|
383
|
+
class="method-args">()</span>
|
384
|
+
|
385
|
+
<span class="method-click-advice">click to toggle source</span>
|
386
|
+
|
387
|
+
</div>
|
388
|
+
|
389
|
+
|
390
|
+
<div class="method-description">
|
391
|
+
|
392
|
+
<p>Imprime la información del alimento</p>
|
393
|
+
<dl class="rdoc-list note-list"><dt>Devuelve
|
394
|
+
<dd>
|
395
|
+
<p>Cadena de texto con la información del alimento</p>
|
396
|
+
</dd></dl>
|
397
|
+
|
398
|
+
|
399
|
+
|
400
|
+
|
401
|
+
<div class="method-source-code" id="to_s-source">
|
402
|
+
<pre><span class="ruby-comment"># File lib/tddAlimentos/alimento.rb, line 36</span>
|
403
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_s</span>
|
404
|
+
<span class="ruby-node">"Nombre: #{@name}\nProteínas (g): #{@protein}\nCarbohidratos (g): #{@carbohydrates}\nLípidos (g): #{@lipids}\nGEI (kgCO2eq): #{@gei}\nTerreno (m2 año): #{@terrain}\n"</span>
|
405
|
+
<span class="ruby-keyword">end</span></pre>
|
406
|
+
</div>
|
407
|
+
|
408
|
+
</div>
|
409
|
+
|
410
|
+
|
411
|
+
|
412
|
+
|
413
|
+
</div>
|
414
|
+
|
415
|
+
|
416
|
+
</section>
|
417
|
+
|
418
|
+
</section>
|
419
|
+
|
420
|
+
</main>
|
421
|
+
|
422
|
+
|
423
|
+
<footer id="validator-badges" role="contentinfo">
|
424
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
425
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.1.0.
|
426
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
427
|
+
</footer>
|
428
|
+
|