gema6 0.2.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/.gitignore +9 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/Guardfile +82 -0
- data/README.md +36 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/gema6.gemspec +38 -0
- data/lib/gema6.rb +11 -0
- data/lib/gema6/dieta.rb +114 -0
- data/lib/gema6/grupoAlimentos.rb +21 -0
- data/lib/gema6/grupoEdad.rb +17 -0
- data/lib/gema6/lista.rb +127 -0
- data/lib/gema6/node.rb +2 -0
- data/lib/gema6/version.rb +4 -0
- metadata +147 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 98732550bf8a8bc003b6aa0f606458fffe6812d7
|
|
4
|
+
data.tar.gz: bccaa075364655d5e18e2db221447803ae283298
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: c2e8c775ff024e766f501953a0ccf8ecd771d875d70eeac1c5f7bb64d289b83633824d1411139b225b4c337924a227cbe3d8edbd0983dc6d47f26d7f9384208e
|
|
7
|
+
data.tar.gz: 5185d38f660870cde134c965a31cc180346306d3fa9a2bece4d3d9ce067027d9c190416e27eadb1520c4a97f888a20b82623b2fc6ce46fa2cd5a8d9d94b3ce2d
|
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,36 @@
|
|
|
1
|
+
# Gema6
|
|
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/gema6`. 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 'gema6'
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
And then execute:
|
|
16
|
+
|
|
17
|
+
$ bundle
|
|
18
|
+
|
|
19
|
+
Or install it yourself as:
|
|
20
|
+
|
|
21
|
+
$ gem install gema6
|
|
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]/gema6.
|
|
36
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "gema6"
|
|
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
data/gema6.gemspec
ADDED
|
@@ -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 'gema6/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "gema6"
|
|
8
|
+
spec.version = Gema6::VERSION
|
|
9
|
+
spec.authors = ["Miguel Castro Caraballo", "Hilario Perez Cruz"]
|
|
10
|
+
spec.email = ["alu0100886870@ull.edu.es", "alu0100207231@ull.edu.es"]
|
|
11
|
+
|
|
12
|
+
spec.summary = "Representa menús de dietas con sus tests."
|
|
13
|
+
spec.description = "Esta práctica consiste en representar menús de dietas con sus respectivos tests mediante TDD"
|
|
14
|
+
spec.homepage = "https://github.com/ULL-ESIT-LPP-1617/tdd-menu-equipo_11"
|
|
15
|
+
|
|
16
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
|
17
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
|
18
|
+
if spec.respond_to?(:metadata)
|
|
19
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
|
20
|
+
else
|
|
21
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
|
22
|
+
"public gem pushes."
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
26
|
+
f.match(%r{^(test|spec|features)/})
|
|
27
|
+
end
|
|
28
|
+
spec.bindir = "exe"
|
|
29
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
30
|
+
spec.require_paths = ["lib"]
|
|
31
|
+
|
|
32
|
+
spec.add_development_dependency "bundler", "~> 1.13"
|
|
33
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
34
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
|
35
|
+
spec.add_development_dependency "guard"
|
|
36
|
+
spec.add_development_dependency "guard-rspec"
|
|
37
|
+
spec.add_development_dependency "guard-bundler"
|
|
38
|
+
end
|
data/lib/gema6.rb
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
require "gema6/version"
|
|
2
|
+
require "gema6/dieta"
|
|
3
|
+
require "gema6/node"
|
|
4
|
+
require "gema6/lista"
|
|
5
|
+
require "gema6/grupoAlimentos"
|
|
6
|
+
require "gema6/grupoEdad"
|
|
7
|
+
|
|
8
|
+
# El modulo de la gema de la práctica (nosotros ponemos el código en cada clase)
|
|
9
|
+
module Gema6
|
|
10
|
+
# Your code goes here...
|
|
11
|
+
end
|
data/lib/gema6/dieta.rb
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
module Gema6
|
|
2
|
+
# Clase que representa una Dieta (menú dietético)
|
|
3
|
+
class Dieta
|
|
4
|
+
include Comparable
|
|
5
|
+
|
|
6
|
+
attr_reader :titulo, :porcentaje, :platos, :vct, :proteinas, :grasas, :hidratos, :porcentaje_min, :porcentaje_max
|
|
7
|
+
def initialize(titulo, porcentaje = nil, platos = [], vct = nil, proteinas = nil, grasas = nil, hidratos = nil, &block)
|
|
8
|
+
@titulo = titulo
|
|
9
|
+
@porcentaje = porcentaje
|
|
10
|
+
@platos = platos
|
|
11
|
+
@vct = vct
|
|
12
|
+
@proteinas = proteinas
|
|
13
|
+
@grasas = grasas
|
|
14
|
+
@hidratos = hidratos
|
|
15
|
+
|
|
16
|
+
if (block_given?)
|
|
17
|
+
instance_eval &block
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Devuelve la descripción completa del plato indicado por parámetro
|
|
22
|
+
def getDescripcion(i)
|
|
23
|
+
@platos.at(i).at(0)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Devuelve el plato indicado por parámetro
|
|
27
|
+
def getPlato(i)
|
|
28
|
+
@platos.at(i)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Devuelve un array (conjunto) de platos especificado por parámetro.
|
|
32
|
+
def getCjtoPlatos(i, k)
|
|
33
|
+
@cjto = []
|
|
34
|
+
for p in i..k
|
|
35
|
+
@cjto.push(@platos.at(p))
|
|
36
|
+
end
|
|
37
|
+
@cjto
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Devuelve la porción que conlleva el plato indicado por parámetro.
|
|
41
|
+
def getPorcion(i)
|
|
42
|
+
getPlato(i).at(1)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Devuelve los gramos que contiene el plato indicado por parámetro.
|
|
46
|
+
def getGramos(i)
|
|
47
|
+
getPlato(i).at(2)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Devuelve una cadena que contiene la descripción completa del menú dietético.
|
|
51
|
+
def to_s
|
|
52
|
+
@resultado = "#{@titulo} (#{@porcentaje}%)\n"
|
|
53
|
+
for p in 0..(@platos.length - 1)
|
|
54
|
+
@resultado.concat("- #{getDescripcion(p)}, #{getPorcion(p)}, #{getGramos(p)} g \n")
|
|
55
|
+
end
|
|
56
|
+
@resultado.concat("V.C.T. | %\t#{@vct} kcal | #{@proteinas}% - #{@grasas}% - #{@hidratos}%")
|
|
57
|
+
|
|
58
|
+
@resultado
|
|
59
|
+
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Método utilizado para comparar un menú con otro.
|
|
63
|
+
def <=>(otro)
|
|
64
|
+
#Cuando comparo un menú con otro, pruebo con el VCT, sino lo miramos segun la grasa, luego proteinas, y por ultimo los hidratos.
|
|
65
|
+
if @vct < otro.vct
|
|
66
|
+
-1
|
|
67
|
+
elsif @vct > otro.vct
|
|
68
|
+
1
|
|
69
|
+
else
|
|
70
|
+
# Si son iguales en VCT, mirar grasas...
|
|
71
|
+
if @grasas < otro.grasas
|
|
72
|
+
-1
|
|
73
|
+
elsif @grasas > otro.grasas
|
|
74
|
+
1
|
|
75
|
+
else
|
|
76
|
+
# Si son iguales en grasas, mirar en proteinas
|
|
77
|
+
if @proteinas < otro.proteinas
|
|
78
|
+
-1
|
|
79
|
+
elsif @proteinas > otro.proteinas
|
|
80
|
+
1
|
|
81
|
+
else
|
|
82
|
+
if @hidratos < otro.hidratos
|
|
83
|
+
-1
|
|
84
|
+
elsif @hidratos > otro.hidratos
|
|
85
|
+
1
|
|
86
|
+
else
|
|
87
|
+
# SON IGUALES
|
|
88
|
+
0
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def ingesta(options = {})
|
|
97
|
+
@porcentaje_min = options[:min]
|
|
98
|
+
@porcentaje_max = options[:max]
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def plato(options = {})
|
|
102
|
+
plato = [options[:descripcion], options[:porcion], options[:gramos]]
|
|
103
|
+
@platos.push(plato)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def porcentajes(options = {})
|
|
107
|
+
@vct = options[:vct]
|
|
108
|
+
@proteinas = options[:proteinas]
|
|
109
|
+
@grasas = options[:grasas]
|
|
110
|
+
@hidratos = options[:hidratos]
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
end
|
|
114
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module Gema6
|
|
2
|
+
# Clase que representa a un grupo de alimentos (genérico)
|
|
3
|
+
class GrupoAlimentos < Dieta
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
# Clase que representa a un grupo de alimentos vegetales (menú vegetal)
|
|
7
|
+
class MenuVegetal < GrupoAlimentos
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# Clase que representa a un grupo de alimentos carnicos (menú cárnico)
|
|
11
|
+
class MenuCarnico < GrupoAlimentos
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# Clase que representa a un grupo de alimentos cereal (menú cereal)
|
|
15
|
+
class MenuCereal < GrupoAlimentos
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Clase que representa a un grupo de alimentos frutas (menú frutas)
|
|
19
|
+
class MenuFrutas < GrupoAlimentos
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module Gema6
|
|
2
|
+
# Clase que representa a un grupo de menús según la edad (genérico)
|
|
3
|
+
class GrupoEdad < Dieta
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
# Clase que representa a un grupo de menús para personas de 4 a 8 años.
|
|
7
|
+
class Menu4_8 < GrupoEdad
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# Clase que representa a un grupo de menús para personas de 9 a 13 años.
|
|
11
|
+
class Menu9_13 < GrupoEdad
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# Clase que representa a un grupo de menús para personas de 14 a 18 años.
|
|
15
|
+
class Menu14_18 < GrupoEdad
|
|
16
|
+
end
|
|
17
|
+
end
|
data/lib/gema6/lista.rb
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
module Gema6
|
|
2
|
+
# Clase que representa a una Lista doblemente enlazada para poder enlazar los menús.
|
|
3
|
+
class Lista
|
|
4
|
+
include Enumerable
|
|
5
|
+
|
|
6
|
+
attr_reader :top, :tail
|
|
7
|
+
def initialize(&block)
|
|
8
|
+
@top
|
|
9
|
+
@tail
|
|
10
|
+
|
|
11
|
+
if (block_given?)
|
|
12
|
+
instance_eval &block
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Inserta un nodo (o conjunto de nodos) por el inicio.
|
|
17
|
+
def insert_head(node)
|
|
18
|
+
# Si el nodo es de tipo array, hay que insertar sus elementos
|
|
19
|
+
# sino, insertamos el nodo individualmente
|
|
20
|
+
|
|
21
|
+
if node.instance_of? Array
|
|
22
|
+
node.each { |element| insert_head(element) }
|
|
23
|
+
elsif node.instance_of? Node
|
|
24
|
+
node.next = @top
|
|
25
|
+
|
|
26
|
+
# Si habia un nodo top, sustituir su atributo "previous" y apuntar al de ahora
|
|
27
|
+
if (@top != nil)
|
|
28
|
+
@top.previous = node
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Asignar ahora a @top el nodo
|
|
32
|
+
@top = node
|
|
33
|
+
|
|
34
|
+
# Si solo hay un nodo, debe ser tanto tail como head
|
|
35
|
+
if (@tail == nil)
|
|
36
|
+
@tail = @top
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Inserta un nodo (o conjunto de nodos) por el final.
|
|
42
|
+
def insert_tail(node)
|
|
43
|
+
# Si el nodo es de tipo array, hay que insertar sus elementos
|
|
44
|
+
# sino, insertamos el nodo individualmente
|
|
45
|
+
|
|
46
|
+
if node.instance_of? Array
|
|
47
|
+
node.each { |element| insert_tail(element) }
|
|
48
|
+
elsif node.instance_of? Node
|
|
49
|
+
node.previous = @tail
|
|
50
|
+
|
|
51
|
+
# Si habia un nodo tail, sustituir su atributo "next" y apuntar al de ahora
|
|
52
|
+
if (@tail != nil)
|
|
53
|
+
@tail.next = node
|
|
54
|
+
end
|
|
55
|
+
@tail = node
|
|
56
|
+
|
|
57
|
+
# Si solo hay un nodo, debe ser tanto tail como head
|
|
58
|
+
if (@top == nil)
|
|
59
|
+
@top = @tail
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Devuelve una cadena que representa la lista y su contenido.
|
|
65
|
+
def to_s
|
|
66
|
+
@resultado = ""
|
|
67
|
+
@numeroMenu = 1
|
|
68
|
+
@nodoActual = @top
|
|
69
|
+
|
|
70
|
+
#Iterar en la lista hasta llegar al final (nil) y hacerles to_s
|
|
71
|
+
while @nodoActual != nil do
|
|
72
|
+
@resultado << @numeroMenu.to_s << ") "
|
|
73
|
+
@resultado << @nodoActual.value.to_s
|
|
74
|
+
@resultado << "\n\n"
|
|
75
|
+
@nodoActual = @nodoActual.next
|
|
76
|
+
@numeroMenu += 1
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
@resultado
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Define la forma en la que se itera por la lista a través del método each.
|
|
83
|
+
def each
|
|
84
|
+
@actual = @top
|
|
85
|
+
while (@actual != nil) do
|
|
86
|
+
yield @actual.value
|
|
87
|
+
@actual = @actual.next
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def menu(options = {})
|
|
92
|
+
insert_head(Node.new(options[:desayuno], nil, nil))
|
|
93
|
+
insert_head(Node.new(options[:mediama], nil, nil))
|
|
94
|
+
insert_head(Node.new(options[:almuerzo], nil, nil))
|
|
95
|
+
insert_head(Node.new(options[:merienda], nil, nil))
|
|
96
|
+
insert_head(Node.new(options[:cena], nil, nil))
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def lunes(menus)
|
|
100
|
+
menu(menus)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def martes(menus)
|
|
104
|
+
menu(menus)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def miercoles(menus)
|
|
108
|
+
menu(menus)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def jueves(menus)
|
|
112
|
+
menu(menus)
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def viernes(menus)
|
|
116
|
+
menu(menus)
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def sabado(menus)
|
|
120
|
+
menu(menus)
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def domingo(menus)
|
|
124
|
+
menu(menus)
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
end
|
data/lib/gema6/node.rb
ADDED
metadata
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: gema6
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.2.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Miguel Castro Caraballo
|
|
8
|
+
- Hilario Perez Cruz
|
|
9
|
+
autorequire:
|
|
10
|
+
bindir: exe
|
|
11
|
+
cert_chain: []
|
|
12
|
+
date: 2016-12-16 00:00:00.000000000 Z
|
|
13
|
+
dependencies:
|
|
14
|
+
- !ruby/object:Gem::Dependency
|
|
15
|
+
name: bundler
|
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
|
17
|
+
requirements:
|
|
18
|
+
- - "~>"
|
|
19
|
+
- !ruby/object:Gem::Version
|
|
20
|
+
version: '1.13'
|
|
21
|
+
type: :development
|
|
22
|
+
prerelease: false
|
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
24
|
+
requirements:
|
|
25
|
+
- - "~>"
|
|
26
|
+
- !ruby/object:Gem::Version
|
|
27
|
+
version: '1.13'
|
|
28
|
+
- !ruby/object:Gem::Dependency
|
|
29
|
+
name: rake
|
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
|
31
|
+
requirements:
|
|
32
|
+
- - "~>"
|
|
33
|
+
- !ruby/object:Gem::Version
|
|
34
|
+
version: '10.0'
|
|
35
|
+
type: :development
|
|
36
|
+
prerelease: false
|
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
38
|
+
requirements:
|
|
39
|
+
- - "~>"
|
|
40
|
+
- !ruby/object:Gem::Version
|
|
41
|
+
version: '10.0'
|
|
42
|
+
- !ruby/object:Gem::Dependency
|
|
43
|
+
name: rspec
|
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
|
45
|
+
requirements:
|
|
46
|
+
- - "~>"
|
|
47
|
+
- !ruby/object:Gem::Version
|
|
48
|
+
version: '3.0'
|
|
49
|
+
type: :development
|
|
50
|
+
prerelease: false
|
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
52
|
+
requirements:
|
|
53
|
+
- - "~>"
|
|
54
|
+
- !ruby/object:Gem::Version
|
|
55
|
+
version: '3.0'
|
|
56
|
+
- !ruby/object:Gem::Dependency
|
|
57
|
+
name: guard
|
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
|
59
|
+
requirements:
|
|
60
|
+
- - ">="
|
|
61
|
+
- !ruby/object:Gem::Version
|
|
62
|
+
version: '0'
|
|
63
|
+
type: :development
|
|
64
|
+
prerelease: false
|
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
66
|
+
requirements:
|
|
67
|
+
- - ">="
|
|
68
|
+
- !ruby/object:Gem::Version
|
|
69
|
+
version: '0'
|
|
70
|
+
- !ruby/object:Gem::Dependency
|
|
71
|
+
name: guard-rspec
|
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
|
73
|
+
requirements:
|
|
74
|
+
- - ">="
|
|
75
|
+
- !ruby/object:Gem::Version
|
|
76
|
+
version: '0'
|
|
77
|
+
type: :development
|
|
78
|
+
prerelease: false
|
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
80
|
+
requirements:
|
|
81
|
+
- - ">="
|
|
82
|
+
- !ruby/object:Gem::Version
|
|
83
|
+
version: '0'
|
|
84
|
+
- !ruby/object:Gem::Dependency
|
|
85
|
+
name: guard-bundler
|
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
|
87
|
+
requirements:
|
|
88
|
+
- - ">="
|
|
89
|
+
- !ruby/object:Gem::Version
|
|
90
|
+
version: '0'
|
|
91
|
+
type: :development
|
|
92
|
+
prerelease: false
|
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
94
|
+
requirements:
|
|
95
|
+
- - ">="
|
|
96
|
+
- !ruby/object:Gem::Version
|
|
97
|
+
version: '0'
|
|
98
|
+
description: Esta práctica consiste en representar menús de dietas con sus respectivos
|
|
99
|
+
tests mediante TDD
|
|
100
|
+
email:
|
|
101
|
+
- alu0100886870@ull.edu.es
|
|
102
|
+
- alu0100207231@ull.edu.es
|
|
103
|
+
executables: []
|
|
104
|
+
extensions: []
|
|
105
|
+
extra_rdoc_files: []
|
|
106
|
+
files:
|
|
107
|
+
- ".gitignore"
|
|
108
|
+
- ".travis.yml"
|
|
109
|
+
- Gemfile
|
|
110
|
+
- Guardfile
|
|
111
|
+
- README.md
|
|
112
|
+
- Rakefile
|
|
113
|
+
- bin/console
|
|
114
|
+
- bin/setup
|
|
115
|
+
- gema6.gemspec
|
|
116
|
+
- lib/gema6.rb
|
|
117
|
+
- lib/gema6/dieta.rb
|
|
118
|
+
- lib/gema6/grupoAlimentos.rb
|
|
119
|
+
- lib/gema6/grupoEdad.rb
|
|
120
|
+
- lib/gema6/lista.rb
|
|
121
|
+
- lib/gema6/node.rb
|
|
122
|
+
- lib/gema6/version.rb
|
|
123
|
+
homepage: https://github.com/ULL-ESIT-LPP-1617/tdd-menu-equipo_11
|
|
124
|
+
licenses: []
|
|
125
|
+
metadata:
|
|
126
|
+
allowed_push_host: https://rubygems.org
|
|
127
|
+
post_install_message:
|
|
128
|
+
rdoc_options: []
|
|
129
|
+
require_paths:
|
|
130
|
+
- lib
|
|
131
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
132
|
+
requirements:
|
|
133
|
+
- - ">="
|
|
134
|
+
- !ruby/object:Gem::Version
|
|
135
|
+
version: '0'
|
|
136
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
|
+
requirements:
|
|
138
|
+
- - ">="
|
|
139
|
+
- !ruby/object:Gem::Version
|
|
140
|
+
version: '0'
|
|
141
|
+
requirements: []
|
|
142
|
+
rubyforge_project:
|
|
143
|
+
rubygems_version: 2.5.1
|
|
144
|
+
signing_key:
|
|
145
|
+
specification_version: 4
|
|
146
|
+
summary: Representa menús de dietas con sus tests.
|
|
147
|
+
test_files: []
|