menu_dietetico-alu0100826999 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +4 -0
- data/Guardfile +82 -0
- data/LICENSE.txt +21 -0
- data/README.md +46 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/menu_dietetico/lista.rb +95 -0
- data/lib/menu_dietetico/menu.rb +242 -0
- data/lib/menu_dietetico/version.rb +3 -0
- data/lib/menu_dietetico.rb +6 -0
- data/menu_dietetico.gemspec +38 -0
- metadata +144 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e5b5f6856ce5fa0e47f2ac625e40665f6fa58015
|
4
|
+
data.tar.gz: c9639b1f209ce6c8afe675d050ce3fdc17d442d6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 05cddebbe5be9b71291ad0b8c22358da6657530175fb45b0fb377f7ee3d15dd1d575719f071018ccd7b42aecd0d626aea869f0d2fe1209c1da05f56bb640653b
|
7
|
+
data.tar.gz: 905bfd7e08ac79e51ebd5ca0508cd827bd293456aa37e5002ddcccc1b5f661fe871ca272d2b502b28f64ae88fffc68bc443e9fdbc4fa9e6a6452220f0dca4b88
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at alu0100826999@ull.edu.es. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
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) 2016 alu0100826999
|
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,46 @@
|
|
1
|
+
Práctica 7. Programación Orientada a Objetos: Menú dietético
|
2
|
+
Práctica 8. Herencia
|
3
|
+
Práctica 9. Módulos
|
4
|
+
Práctica 11. Lenguajes de Dominio Específico (DSL)
|
5
|
+
|
6
|
+
# MenuDietetico
|
7
|
+
|
8
|
+
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/menu_dietetico`. To experiment with that code, run `bin/console` for an interactive prompt.
|
9
|
+
|
10
|
+
TODO: Delete this and the text above, and describe your gem
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
Add this line to your application's Gemfile:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
gem 'menu_dietetico'
|
18
|
+
```
|
19
|
+
|
20
|
+
And then execute:
|
21
|
+
|
22
|
+
$ bundle
|
23
|
+
|
24
|
+
Or install it yourself as:
|
25
|
+
|
26
|
+
$ gem install menu_dietetico
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
TODO: Write usage instructions here
|
31
|
+
|
32
|
+
## Development
|
33
|
+
|
34
|
+
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.
|
35
|
+
|
36
|
+
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).
|
37
|
+
|
38
|
+
## Contributing
|
39
|
+
|
40
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/menu_dietetico. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
41
|
+
|
42
|
+
|
43
|
+
## License
|
44
|
+
|
45
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
46
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "menu_dietetico"
|
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
|
data/bin/setup
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
Node = Struct.new(:value, :next, :prev)
|
2
|
+
|
3
|
+
#CLase que representa una lista doblemente enlazada
|
4
|
+
class ListaDoble
|
5
|
+
|
6
|
+
include Enumerable
|
7
|
+
|
8
|
+
attr_reader :head, :tail
|
9
|
+
|
10
|
+
def initialize()
|
11
|
+
@head = nil
|
12
|
+
@tail = nil
|
13
|
+
end
|
14
|
+
|
15
|
+
def empty()
|
16
|
+
vacio = false
|
17
|
+
if (@head == nil)
|
18
|
+
vacio = true
|
19
|
+
elsif
|
20
|
+
vacio == false
|
21
|
+
end
|
22
|
+
return vacio
|
23
|
+
end
|
24
|
+
|
25
|
+
def insert_head(node)
|
26
|
+
if (empty())
|
27
|
+
@head = node
|
28
|
+
@tail = @head
|
29
|
+
elsif
|
30
|
+
@head.prev = node
|
31
|
+
node.next = @head
|
32
|
+
@head = node
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def insert_tail(node)
|
37
|
+
if (empty())
|
38
|
+
@head = node
|
39
|
+
@tail = @head
|
40
|
+
elsif
|
41
|
+
@tail.next = node
|
42
|
+
node.prev = @tail
|
43
|
+
@tail = node
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def extract_head()
|
48
|
+
if (empty())
|
49
|
+
return nil
|
50
|
+
elsif
|
51
|
+
node = @head
|
52
|
+
@head = @head.next
|
53
|
+
node.next = nil
|
54
|
+
node.prev = nil
|
55
|
+
return node.value
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def extract_tail()
|
60
|
+
if (empty())
|
61
|
+
return nil
|
62
|
+
elsif
|
63
|
+
node = @tail
|
64
|
+
@tail = @tail.prev
|
65
|
+
if (@tail)
|
66
|
+
@tail.next = nil
|
67
|
+
elsif
|
68
|
+
@head == nil
|
69
|
+
end
|
70
|
+
node.next = nil
|
71
|
+
node.prev = nil
|
72
|
+
return node.value
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def insert_muchos(nodes)
|
77
|
+
i=0
|
78
|
+
total=nodes.length
|
79
|
+
while i<total do
|
80
|
+
insert_head(nodes[i])
|
81
|
+
i=i+1
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def each
|
86
|
+
node = @head
|
87
|
+
while(node != nil)
|
88
|
+
yield node.value
|
89
|
+
node = node.next
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
|
@@ -0,0 +1,242 @@
|
|
1
|
+
#Clase que representa un Menu
|
2
|
+
class Menu
|
3
|
+
|
4
|
+
include Comparable
|
5
|
+
|
6
|
+
attr_accessor :titulo, :name, :ingestas, :porcentaje, :conjunto_platos, :conjunto_valores
|
7
|
+
|
8
|
+
def initialize(name, &bloque)
|
9
|
+
self.name = name
|
10
|
+
self.titulo = ""
|
11
|
+
self.ingestas = []
|
12
|
+
self.conjunto_platos = []
|
13
|
+
self.conjunto_valores = []
|
14
|
+
|
15
|
+
if block_given?
|
16
|
+
if bloque.arity == 1
|
17
|
+
yield self
|
18
|
+
else
|
19
|
+
instance_eval(&bloque)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def titulo_(titulos)
|
25
|
+
self.titulo = titulos
|
26
|
+
end
|
27
|
+
|
28
|
+
def ingesta(options = {})
|
29
|
+
ingesta = "#{options[:min]}, " if options[:min]
|
30
|
+
ingesta << "#{options[:max]}" if options[:max]
|
31
|
+
ingestas << ingesta
|
32
|
+
ingestas << "\n"
|
33
|
+
end
|
34
|
+
|
35
|
+
def plato(options = {})
|
36
|
+
platos = "#{options[:descripcion]}, " if options[:descripcion]
|
37
|
+
platos << "#{options[:porcion]}, " if options[:porcion]
|
38
|
+
platos << "#{options[:gramos]}" if options[:gramos]
|
39
|
+
conjunto_platos << platos
|
40
|
+
conjunto_platos << "\n"
|
41
|
+
end
|
42
|
+
|
43
|
+
def porcentajes(options = {})
|
44
|
+
porcentaje = "#{options[:vct]}, " if options[:vct]
|
45
|
+
porcentaje << "#{options[:proteinas]} - " if options[:proteinas]
|
46
|
+
porcentaje << "#{options[:grasas]} - " if options[:grasas]
|
47
|
+
porcentaje << "#{options[:hidratos]}" if options[:hidratos]
|
48
|
+
conjunto_valores << porcentaje
|
49
|
+
conjunto_valores << "\n"
|
50
|
+
end
|
51
|
+
|
52
|
+
def to_s
|
53
|
+
output = "\n"
|
54
|
+
output << titulo
|
55
|
+
output << "\n"
|
56
|
+
output << "#{ingesta.join()}"
|
57
|
+
#conjunto_platos.each_with_index do |conjunto_platos, index|
|
58
|
+
# output << "\n#{conjunto_platos}"
|
59
|
+
#end
|
60
|
+
#conjunto_valores.each_with_index do |conjunto_valores, index|
|
61
|
+
# output << "\n#{conjunto_valores}"
|
62
|
+
#end
|
63
|
+
output << "#{conjunto_platos.join()}\n"
|
64
|
+
output << "#{conjunto_valores.join()}\n\n"
|
65
|
+
end
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
#####Método de Modulo Comparable####
|
70
|
+
#Comparamos el valor calórico total
|
71
|
+
def <=> (other)
|
72
|
+
@vct<=> other.vct
|
73
|
+
end
|
74
|
+
|
75
|
+
##############################PUTS###################################
|
76
|
+
|
77
|
+
menu = Menu.new("Etiqueta") do
|
78
|
+
|
79
|
+
titulo_ "Almuerzo"
|
80
|
+
ingesta :min => 30, :max => 35
|
81
|
+
|
82
|
+
plato :descripcion => "Macarrones con salsa de tomate y queso parmesano",
|
83
|
+
:porcion => "1 1/2 cucharón",
|
84
|
+
:gramos => 200
|
85
|
+
|
86
|
+
plato :descripcion => "Escalope de ternera",
|
87
|
+
:porcion => "1 bistec mediano",
|
88
|
+
:gramos => 100
|
89
|
+
|
90
|
+
plato :descripcion => "Ensalada básica con zanahoria rallada",
|
91
|
+
:porcion => "guarnición",
|
92
|
+
:gramos => 120
|
93
|
+
|
94
|
+
plato :descripcion => "Mandarina",
|
95
|
+
:porcion => "1 grande",
|
96
|
+
:gramos => 180
|
97
|
+
|
98
|
+
plato :descripcion => "Pan de trigo integral",
|
99
|
+
:porcion => "1 rodaja",
|
100
|
+
:gramos => 20
|
101
|
+
|
102
|
+
porcentajes :vct => 785.9,
|
103
|
+
:proteinas => 19,
|
104
|
+
:grasas => 34,
|
105
|
+
:hidratos => 47
|
106
|
+
|
107
|
+
end
|
108
|
+
|
109
|
+
puts menu
|
110
|
+
|
111
|
+
end
|
112
|
+
|
113
|
+
|
114
|
+
###############################PRÁCTICAS ANTERIORES#############################
|
115
|
+
=begin
|
116
|
+
attr_reader :titulo, :porcentaje, :plato, :porcion, :ingesta, :vct, :proteinas, :grasas, :hidratos
|
117
|
+
|
118
|
+
def initialize(titulo, porcentaje, plato, porcion, ingesta, vct, proteinas, grasas, hidratos)
|
119
|
+
@titulo = titulo
|
120
|
+
@porcentaje = porcentaje
|
121
|
+
@plato = plato
|
122
|
+
@porcion = porcion
|
123
|
+
@ingesta = ingesta
|
124
|
+
@vct = vct
|
125
|
+
@proteinas = proteinas
|
126
|
+
@grasas = grasas
|
127
|
+
@hidratos = hidratos
|
128
|
+
end
|
129
|
+
#Metodo para mostrar el titulo de un menu
|
130
|
+
def titulo_to_s
|
131
|
+
"#{@titulo}"
|
132
|
+
end
|
133
|
+
#Metodo para mostrar el porcentaje de un menu
|
134
|
+
def porcentaje_to_s
|
135
|
+
"#{@porcentaje}"
|
136
|
+
end
|
137
|
+
#Metodo para mostrar el plato de un menu
|
138
|
+
def plato_to_s
|
139
|
+
"#{@plato}"
|
140
|
+
end
|
141
|
+
#Metodo para mostrar la porción de un plato de un menu
|
142
|
+
def porcion_to_s
|
143
|
+
"#{@porcion}"
|
144
|
+
end
|
145
|
+
#Metodo para mostrar la cantidad de un plato del menu
|
146
|
+
def ingesta_to_s
|
147
|
+
"#{@ingesta}"
|
148
|
+
end
|
149
|
+
#Metodo para mostrar el plato con su porcion y su cantidad
|
150
|
+
def conjunto_platos_to_s
|
151
|
+
s=""
|
152
|
+
i=0
|
153
|
+
total=@plato.length
|
154
|
+
while i<total do
|
155
|
+
s<<"\n#{@plato[i]}"
|
156
|
+
s<<", #{@porcion[i]}"
|
157
|
+
s<<", #{@ingesta[i]}"
|
158
|
+
i=i+1
|
159
|
+
end
|
160
|
+
return s
|
161
|
+
end
|
162
|
+
|
163
|
+
def vct_to_s
|
164
|
+
"#{@vct}"
|
165
|
+
end
|
166
|
+
|
167
|
+
def proteinas_to_s
|
168
|
+
"#{@proteinas}"
|
169
|
+
end
|
170
|
+
|
171
|
+
def por_grasas_to_s
|
172
|
+
"#{@grasas}"
|
173
|
+
end
|
174
|
+
|
175
|
+
def hidratos_to_s
|
176
|
+
"#{@hidratos}"
|
177
|
+
end
|
178
|
+
#Metodo para mostrar todos los to_s anteriores
|
179
|
+
def to_s
|
180
|
+
s=""
|
181
|
+
s<<"\n#{titulo_to_s} #{porcentaje_to_s}"
|
182
|
+
s<<"#{conjunto_platos_to_s}"
|
183
|
+
s<<"\nV.C.T. | % #{vct_to_s} | #{proteinas_to_s} - #{por_grasas_to_s} - #{hidratos_to_s}"
|
184
|
+
end
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
#####################################
|
190
|
+
|
191
|
+
@dieta1 = Menu.new("DESAYUNO", "(15%)", ["Lecha desnatada", "Cacao instantáneo", "Cereales de desayuno en hojuelas", "Almendras laminadas"], ["1 vaso", "1 c/sopera", "1 bol pequeño", "2 c/soperas"], ["200ml", "10g", "40g", "10g"], "288.0 kcal", "17%", "21%", "62%")
|
192
|
+
@dieta2 = Menu.new("MEDIA MAÑANA", "(10%)",["Cerezas", "Galletas bifidus con sésamo"], ["10-12 unidades medianas", "4 unidades"],["120g", "40g"],"255.5 kcal","7%","24%","69%")
|
193
|
+
@dieta3 = Menu.new("ALMUERZO", "(30 - 35%)", ["Macarrones con salsa de tomate y queso parmesano","Escalope de ternera","Ensalada básica con zanahoria rallada","Mandarina","Pan de trigo integral"], ["1 1/2 cucharón","1 bistec mediano","guarnición","1 grande","1 rodaja"], ["200 g","100 g","120 g","180 g","20 g"], "785.9 kcal", "19%", "34%", "47%")
|
194
|
+
@dieta4 = Menu.new("MERIENDA", "(15%)",["Galletas de leche con chocolate y yogur","Flan de vainilla sin huevo"], ["4 unidades", "1 unidad"],["46 g", "110 g"],"313.6 kcal","10%","30%","60%")
|
195
|
+
@dieta5 = Menu.new("CENA", "(25 - 30%)",["Crema de bubangos", "Tortila campesina con espinacas", "Tomate en dados con atún", "Piña natural o en su jugo picada", "Pan de trigo integral"], ["2 cucharones", "1 cuña grande", "5 a 6 c/soperas", "5 c/soperas", "1 rodaja"],["200g", "150g", "150g", "120g", "20g"],"561.6 kcal","19%","40%","41%")
|
196
|
+
puts @dieta1
|
197
|
+
puts @dieta2
|
198
|
+
puts @dieta3
|
199
|
+
puts @dieta4
|
200
|
+
puts @dieta5
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
end
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
class GruposAlimentos < Menu
|
209
|
+
|
210
|
+
attr_reader :alimento
|
211
|
+
|
212
|
+
def initialize(alimento, titulo, porcentaje, plato, porcion, ingesta, vct, proteinas, grasas, hidratos)
|
213
|
+
super(titulo, porcentaje, plato, porcion, ingesta, vct, proteinas, grasas, hidratos)
|
214
|
+
@alimento = alimento
|
215
|
+
end
|
216
|
+
|
217
|
+
def to_s
|
218
|
+
m=""
|
219
|
+
m << "\n#{@alimento}"
|
220
|
+
m << super.to_s
|
221
|
+
end
|
222
|
+
|
223
|
+
end
|
224
|
+
|
225
|
+
class GruposEdad < Menu
|
226
|
+
|
227
|
+
attr_reader :edad
|
228
|
+
|
229
|
+
def initialize(edad, titulo, porcentaje, plato, porcion, ingesta, vct, proteinas, grasas, hidratos)
|
230
|
+
super(titulo, porcentaje, plato, porcion, ingesta, vct, proteinas, grasas, hidratos)
|
231
|
+
@edad = edad
|
232
|
+
end
|
233
|
+
|
234
|
+
def to_s
|
235
|
+
m=""
|
236
|
+
m << "\nGrupo de edad: #{@edad}"
|
237
|
+
m << super.to_s
|
238
|
+
end
|
239
|
+
|
240
|
+
end
|
241
|
+
|
242
|
+
=end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'menu_dietetico/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "menu_dietetico-alu0100826999"
|
8
|
+
spec.version = MenuDietetico::VERSION
|
9
|
+
spec.authors = ["alu0100826999"]
|
10
|
+
spec.email = ["alu0100826999@ull.edu.es"]
|
11
|
+
|
12
|
+
spec.summary = %q{Práctica 7 y Práctica 8 y Práctica 9 y Práctica 11}
|
13
|
+
spec.description = %q{Creación de un menú dietético por medio de listas enlazadas y doblemente enlazadas y incluidos Comparable y Enumerable y DSL}
|
14
|
+
spec.homepage = "https://github.com/ULL-ESIT-LPP-1617/menu-dietetico-alu0100826999"
|
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
|
+
=begin
|
20
|
+
if spec.respond_to?(:metadata)
|
21
|
+
spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
22
|
+
else
|
23
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
24
|
+
end
|
25
|
+
=end
|
26
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
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.12"
|
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
|
+
|
38
|
+
end
|
metadata
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: menu_dietetico-alu0100826999
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- alu0100826999
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-12-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.12'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.12'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: guard
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: guard-rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: guard-bundler
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: Creación de un menú dietético por medio de listas enlazadas y doblemente
|
98
|
+
enlazadas y incluidos Comparable y Enumerable y DSL
|
99
|
+
email:
|
100
|
+
- alu0100826999@ull.edu.es
|
101
|
+
executables: []
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- ".gitignore"
|
106
|
+
- ".travis.yml"
|
107
|
+
- CODE_OF_CONDUCT.md
|
108
|
+
- Gemfile
|
109
|
+
- Guardfile
|
110
|
+
- LICENSE.txt
|
111
|
+
- README.md
|
112
|
+
- Rakefile
|
113
|
+
- bin/console
|
114
|
+
- bin/setup
|
115
|
+
- lib/menu_dietetico.rb
|
116
|
+
- lib/menu_dietetico/lista.rb
|
117
|
+
- lib/menu_dietetico/menu.rb
|
118
|
+
- lib/menu_dietetico/version.rb
|
119
|
+
- menu_dietetico.gemspec
|
120
|
+
homepage: https://github.com/ULL-ESIT-LPP-1617/menu-dietetico-alu0100826999
|
121
|
+
licenses:
|
122
|
+
- MIT
|
123
|
+
metadata: {}
|
124
|
+
post_install_message:
|
125
|
+
rdoc_options: []
|
126
|
+
require_paths:
|
127
|
+
- lib
|
128
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
requirements: []
|
139
|
+
rubyforge_project:
|
140
|
+
rubygems_version: 2.5.1
|
141
|
+
signing_key:
|
142
|
+
specification_version: 4
|
143
|
+
summary: Práctica 7 y Práctica 8 y Práctica 9 y Práctica 11
|
144
|
+
test_files: []
|