Dieta-alu0100818130 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +67 -0
- data/.travis.yml +5 -0
- data/Dieta.gemspec +39 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +88 -0
- data/Guardfile +82 -0
- data/Rakefile +16 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/Dieta/dgrpal.rb +15 -0
- data/lib/Dieta/dgrpedad.rb +15 -0
- data/lib/Dieta/dieta.rb +34 -0
- data/lib/Dieta/lista.rb +113 -0
- data/lib/Dieta/menu.rb +73 -0
- data/lib/Dieta/version.rb +3 -0
- data/lib/Dieta.rb +10 -0
- metadata +146 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4e3e37499e49530cb09e6aa7763965ddc90a16a4
|
4
|
+
data.tar.gz: 5c8b474ba0ca516c9dfbd2805413598e68239dd0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d99d768d70f97c4e40bef8f66334bedcbe172485839f1f34c37c357132430fa8fc9814766d347b7b74a1b4695adcfe4c1b20e7c59ef1ee37fb9e9b6eb8d513a4
|
7
|
+
data.tar.gz: 4a4c1a0c49febdea02d2839198925ba05d9a1ffa1da4571b956f8231615efa05e49c50a507effb9c7ea475ce6450877fb2445074f0552a90415af596d2b30f23
|
data/.gitignore
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
### Ruby ###
|
2
|
+
*.gem
|
3
|
+
*.rbc
|
4
|
+
/.config
|
5
|
+
/coverage/
|
6
|
+
/InstalledFiles
|
7
|
+
/pkg/
|
8
|
+
/spec/reports/
|
9
|
+
/spec/examples.txt
|
10
|
+
/test/tmp/
|
11
|
+
/test/version_tmp/
|
12
|
+
/tmp/
|
13
|
+
|
14
|
+
# Used by dotenv library to load environment variables.
|
15
|
+
# .env
|
16
|
+
|
17
|
+
## Specific to RubyMotion:
|
18
|
+
.dat*
|
19
|
+
.repl_history
|
20
|
+
build/
|
21
|
+
*.bridgesupport
|
22
|
+
build-iPhoneOS/
|
23
|
+
build-iPhoneSimulator/
|
24
|
+
|
25
|
+
## Specific to RubyMotion (use of CocoaPods):
|
26
|
+
#
|
27
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
28
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
29
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
30
|
+
#
|
31
|
+
# vendor/Pods/
|
32
|
+
|
33
|
+
## Documentation cache and generated files:
|
34
|
+
/.yardoc/
|
35
|
+
/_yardoc/
|
36
|
+
/doc/
|
37
|
+
/rdoc/
|
38
|
+
|
39
|
+
## Environment normalization:
|
40
|
+
/.bundle/
|
41
|
+
/vendor/bundle
|
42
|
+
/lib/bundler/man/
|
43
|
+
|
44
|
+
# for a library or gem, you might want to ignore these files since the code is
|
45
|
+
# intended to run in multiple environments; otherwise, check them in:
|
46
|
+
# Gemfile.lock
|
47
|
+
# .ruby-version
|
48
|
+
# .ruby-gemset
|
49
|
+
|
50
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
51
|
+
.rvmrc# See https://help.github.com/articles/ignoring-files for more about ignoring files.
|
52
|
+
#
|
53
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
54
|
+
# or operating system, you probably want to add a global ignore instead:
|
55
|
+
# git config --global core.excludesfile '~/.gitignore_global'
|
56
|
+
|
57
|
+
# Ignore bundler config.
|
58
|
+
/.bundle
|
59
|
+
|
60
|
+
# Ignore the default SQLite database.
|
61
|
+
/db/*.sqlite3
|
62
|
+
/db/*.sqlite3-journal
|
63
|
+
|
64
|
+
# Ignore all logfiles and tempfiles.
|
65
|
+
/log/*
|
66
|
+
!/log/.keep
|
67
|
+
/tmp
|
data/.travis.yml
ADDED
data/Dieta.gemspec
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'Dieta/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "Dieta-alu0100818130"
|
8
|
+
spec.version = Dietas::VERSION
|
9
|
+
spec.authors = ["Aduanich Rguez Rguez", "Alejandro Carrillo Padrón"]
|
10
|
+
spec.email = ["alu0100818130@ull.edu.es","alu0100845808@ull.edu.es"]
|
11
|
+
|
12
|
+
spec.summary = %q{"Clase Dieta"}
|
13
|
+
spec.description = %q{"Desarollo TDD de la clase dieta utilizando Bundler"}
|
14
|
+
spec.homepage = "https://github.com/ULL-ESIT-LPP-1617/tdd-menu-equipo-10"
|
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'] = "TODO: Set to 'http://mygemserver.com'"
|
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
|
+
spec.metadata["yard.run"] = "yri"
|
39
|
+
end
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
Dieta-alu0100818130 (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
coderay (1.1.1)
|
10
|
+
diff-lcs (1.2.5)
|
11
|
+
ffi (1.9.14)
|
12
|
+
formatador (0.2.5)
|
13
|
+
guard (2.14.0)
|
14
|
+
formatador (>= 0.2.4)
|
15
|
+
listen (>= 2.7, < 4.0)
|
16
|
+
lumberjack (~> 1.0)
|
17
|
+
nenv (~> 0.1)
|
18
|
+
notiffany (~> 0.0)
|
19
|
+
pry (>= 0.9.12)
|
20
|
+
shellany (~> 0.0)
|
21
|
+
thor (>= 0.18.1)
|
22
|
+
guard-bundler (2.1.0)
|
23
|
+
bundler (~> 1.0)
|
24
|
+
guard (~> 2.2)
|
25
|
+
guard-compat (~> 1.1)
|
26
|
+
guard-compat (1.2.1)
|
27
|
+
guard-rspec (4.7.3)
|
28
|
+
guard (~> 2.1)
|
29
|
+
guard-compat (~> 1.1)
|
30
|
+
rspec (>= 2.99.0, < 4.0)
|
31
|
+
listen (3.1.5)
|
32
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
33
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
34
|
+
ruby_dep (~> 1.2)
|
35
|
+
lumberjack (1.0.10)
|
36
|
+
method_source (0.8.2)
|
37
|
+
mini_portile2 (2.1.0)
|
38
|
+
nenv (0.3.0)
|
39
|
+
nokogiri (1.6.8.1)
|
40
|
+
mini_portile2 (~> 2.1.0)
|
41
|
+
notiffany (0.1.1)
|
42
|
+
nenv (~> 0.1)
|
43
|
+
shellany (~> 0.0)
|
44
|
+
pry (0.10.4)
|
45
|
+
coderay (~> 1.1.0)
|
46
|
+
method_source (~> 0.8.1)
|
47
|
+
slop (~> 3.4)
|
48
|
+
rack (1.6.4)
|
49
|
+
rake (10.5.0)
|
50
|
+
rb-fsevent (0.9.8)
|
51
|
+
rb-inotify (0.9.7)
|
52
|
+
ffi (>= 0.5.0)
|
53
|
+
rspec (3.5.0)
|
54
|
+
rspec-core (~> 3.5.0)
|
55
|
+
rspec-expectations (~> 3.5.0)
|
56
|
+
rspec-mocks (~> 3.5.0)
|
57
|
+
rspec-core (3.5.4)
|
58
|
+
rspec-support (~> 3.5.0)
|
59
|
+
rspec-expectations (3.5.0)
|
60
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
61
|
+
rspec-support (~> 3.5.0)
|
62
|
+
rspec-mocks (3.5.0)
|
63
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
64
|
+
rspec-support (~> 3.5.0)
|
65
|
+
rspec-support (3.5.0)
|
66
|
+
ruby_dep (1.5.0)
|
67
|
+
shellany (0.0.1)
|
68
|
+
slop (3.6.0)
|
69
|
+
thor (0.19.1)
|
70
|
+
yard (0.9.5)
|
71
|
+
|
72
|
+
PLATFORMS
|
73
|
+
ruby
|
74
|
+
|
75
|
+
DEPENDENCIES
|
76
|
+
Dieta-alu0100818130!
|
77
|
+
bundler (~> 1.13)
|
78
|
+
guard
|
79
|
+
guard-bundler
|
80
|
+
guard-rspec
|
81
|
+
nokogiri
|
82
|
+
rack (~> 1.1)
|
83
|
+
rake (~> 10.0)
|
84
|
+
rspec
|
85
|
+
yard
|
86
|
+
|
87
|
+
BUNDLED WITH
|
88
|
+
1.13.6
|
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/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
|
4
|
+
# RSpec::Core::RakeTask.new
|
5
|
+
|
6
|
+
task :default => :spec
|
7
|
+
|
8
|
+
desc "Ejecutar las espectativas de la clase Dieta"
|
9
|
+
task :spec do
|
10
|
+
sh "rspec -I. spec/dieta_spec.rb"
|
11
|
+
end
|
12
|
+
|
13
|
+
desc "Ejecutar con documentacion"
|
14
|
+
task :doc do
|
15
|
+
sh "rspec -I. spec/dieta_spec.rb --format documentation"
|
16
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "my_gem"
|
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/lib/Dieta/dgrpal.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require '/home/ubuntu/workspace/pr8/Dieta/lib/Dieta/dieta'
|
2
|
+
|
3
|
+
class Dgrpal < Dieta
|
4
|
+
attr_accessor :grpal
|
5
|
+
def initialize (titulo,porcmenu,desc_platos,por_platos,gr_platos,vct,porcprot,porcgrasas,porchidratos,grpal)
|
6
|
+
super(titulo,porcmenu,desc_platos,por_platos,gr_platos,vct,porcprot,porcgrasas,porchidratos)
|
7
|
+
@grpal = grpal
|
8
|
+
end
|
9
|
+
|
10
|
+
def to_s
|
11
|
+
s = "\n\nGrupo alimenticio de la Dieta: #{@grpal}"
|
12
|
+
s << super.to_s
|
13
|
+
s
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require '/home/ubuntu/workspace/pr8/Dieta/lib/Dieta/dieta'
|
2
|
+
|
3
|
+
class Dgrpedad < Dieta
|
4
|
+
attr_accessor :grpedad
|
5
|
+
def initialize (titulo,porcmenu,desc_platos,por_platos,gr_platos,vct,porcprot,porcgrasas,porchidratos,grpedad)
|
6
|
+
super(titulo,porcmenu,desc_platos,por_platos,gr_platos,vct,porcprot,porcgrasas,porchidratos)
|
7
|
+
@grpedad = grpedad
|
8
|
+
end
|
9
|
+
|
10
|
+
def to_s
|
11
|
+
s = "\n\nGrupo de Edad de la Dieta: #{@grpedad}"
|
12
|
+
s << super.to_s
|
13
|
+
s
|
14
|
+
end
|
15
|
+
end
|
data/lib/Dieta/dieta.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
class Dieta
|
2
|
+
attr_accessor :titulo, :porcmenu, :desc_platos, :por_platos, :gr_platos, :vct, :porcprot, :porcgrasas, :porchidratos
|
3
|
+
include Comparable
|
4
|
+
def initialize(titulo,porcmenu,desc_platos,por_platos,gr_platos,vct,porcprot,porcgrasas,porchidratos)
|
5
|
+
@titulo=titulo
|
6
|
+
@porcmenu=porcmenu
|
7
|
+
@desc_platos=desc_platos
|
8
|
+
@por_platos=por_platos
|
9
|
+
@gr_platos=gr_platos
|
10
|
+
@vct=vct
|
11
|
+
@porcprot=porcprot
|
12
|
+
@porcgrasas=porcgrasas
|
13
|
+
@porchidratos=porchidratos
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
def <=> (other)
|
18
|
+
return nil if other.nil?
|
19
|
+
if(@porcmenu == other.porcmenu)
|
20
|
+
@vct <=> other.vct
|
21
|
+
else
|
22
|
+
@porcmenu <=> other.porcmenu
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def to_s
|
27
|
+
s="\n#{@titulo} (#{@porcmenu})\n"
|
28
|
+
(0..@desc_platos.size-1).each do |i|
|
29
|
+
s<< "#{@desc_platos[i]}, #{@por_platos[i]}, #{@gr_platos[i]}g.\n"
|
30
|
+
end
|
31
|
+
s<< "VCT | %\t#{@vct} kcal | #{@porcprot}% - #{@porcgrasas}% - #{@porchidratos}%\n"
|
32
|
+
s
|
33
|
+
end
|
34
|
+
end
|
data/lib/Dieta/lista.rb
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
Node = Struct.new(:value, :prev, :next)
|
2
|
+
class Lista
|
3
|
+
include Enumerable
|
4
|
+
attr_accessor :head, :tail
|
5
|
+
|
6
|
+
# Constructor initialize
|
7
|
+
def initialize(valor)
|
8
|
+
@head = Node.new(valor,nil,nil)
|
9
|
+
@tail = @head
|
10
|
+
end
|
11
|
+
|
12
|
+
# Each
|
13
|
+
|
14
|
+
def each
|
15
|
+
aux = @head
|
16
|
+
while aux != nil
|
17
|
+
yield aux.value
|
18
|
+
aux = aux.next
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# Empty
|
23
|
+
def empty
|
24
|
+
@head.value==nil
|
25
|
+
end
|
26
|
+
|
27
|
+
# Insertar elemento en lista
|
28
|
+
|
29
|
+
# Head
|
30
|
+
|
31
|
+
def insert_head(valor)
|
32
|
+
if empty
|
33
|
+
aux = Node.new(valor, nil, nil)
|
34
|
+
@head = @tail = aux
|
35
|
+
else
|
36
|
+
aux = Node.new(valor, nil, @head)
|
37
|
+
@head.prev = aux
|
38
|
+
@head = aux
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# Tail
|
43
|
+
|
44
|
+
def insert_tail(valor)
|
45
|
+
if empty
|
46
|
+
aux = Node.new(valor, nil, nil)
|
47
|
+
@head = @tail = aux
|
48
|
+
else
|
49
|
+
aux = Node.new(valor, @tail, nil)
|
50
|
+
@tail.next = aux
|
51
|
+
@tail = aux
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# Extraer elemento en lista
|
56
|
+
|
57
|
+
# Head
|
58
|
+
|
59
|
+
def extract_head
|
60
|
+
if empty
|
61
|
+
nil
|
62
|
+
else
|
63
|
+
aux = @head.value
|
64
|
+
@head = @head.next
|
65
|
+
@head.prev = nil
|
66
|
+
aux
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# Tail
|
71
|
+
|
72
|
+
def extract_tail
|
73
|
+
if empty
|
74
|
+
nil
|
75
|
+
else
|
76
|
+
aux = @tail.value
|
77
|
+
@tail = @tail.prev
|
78
|
+
@tail.next = nil
|
79
|
+
aux
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
|
85
|
+
|
86
|
+
class Lista_ordenacion
|
87
|
+
attr_accessor :l1, :ordenacion
|
88
|
+
|
89
|
+
def initialize()
|
90
|
+
@l1 = Lista.new(nil)
|
91
|
+
end
|
92
|
+
|
93
|
+
def insert_head(a)
|
94
|
+
aux = @l1.insert_head(a)
|
95
|
+
@ordenacion = @l1.sort
|
96
|
+
aux
|
97
|
+
end
|
98
|
+
|
99
|
+
def insert_tail(a)
|
100
|
+
aux = @l1.insert_tail(a)
|
101
|
+
@ordenacion = @l1.sort
|
102
|
+
aux
|
103
|
+
end
|
104
|
+
|
105
|
+
def extract_tail
|
106
|
+
@l1.extract_tail
|
107
|
+
end
|
108
|
+
|
109
|
+
def extract_head
|
110
|
+
@l1.extract_head
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
data/lib/Dieta/menu.rb
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
class Menu
|
2
|
+
attr_accessor :etiqueta, :title2, :ingest, :plat, :porcentaje
|
3
|
+
|
4
|
+
def initialize(etiqueta, &block)
|
5
|
+
self.etiqueta = etiqueta
|
6
|
+
self.title2 = ""
|
7
|
+
self.ingest = []
|
8
|
+
self.plat = []
|
9
|
+
self.porcentaje = []
|
10
|
+
|
11
|
+
if block_given?
|
12
|
+
if block.arity == 1
|
13
|
+
yield self
|
14
|
+
else
|
15
|
+
instance_eval(&block)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# def TITULO
|
21
|
+
def titulo(bloque = {})
|
22
|
+
title2 << "#{bloque[:title]}"
|
23
|
+
end
|
24
|
+
|
25
|
+
def ingesta(bloque = {})
|
26
|
+
inges = []
|
27
|
+
inges << "#{bloque[:min]}"
|
28
|
+
inges << "#{bloque[:max]}"
|
29
|
+
ingest << inges
|
30
|
+
end
|
31
|
+
|
32
|
+
def plato(bloque = {})
|
33
|
+
pl = []
|
34
|
+
pl << "#{bloque[:descripcion]}"
|
35
|
+
pl << "#{bloque[:porcion]}"
|
36
|
+
pl << "#{bloque[:gramos]}"
|
37
|
+
plat << pl
|
38
|
+
end
|
39
|
+
|
40
|
+
def porcentajes(bloque = {})
|
41
|
+
porc = []
|
42
|
+
porc << "#{bloque[:vct]}"
|
43
|
+
porc << "#{bloque[:proteinas]}"
|
44
|
+
porc << "#{bloque[:grasas]}"
|
45
|
+
porc << "#{bloque[:hidratos]}"
|
46
|
+
porcentaje << porc
|
47
|
+
end
|
48
|
+
|
49
|
+
def to_s
|
50
|
+
output = "\n\n#{title2}"
|
51
|
+
output << "\n#{'=' * title2.size}\n"
|
52
|
+
|
53
|
+
ingest.each do |iii|
|
54
|
+
output << "Min: #{iii[0]}"
|
55
|
+
output << ", Max: #{iii[1]}\n"
|
56
|
+
end
|
57
|
+
|
58
|
+
plat.each do |pltt|
|
59
|
+
output << "Plato: #{pltt[0]}"
|
60
|
+
output << ", Porción: #{pltt[1]}"
|
61
|
+
output << ", Gramos: #{pltt[2]}\n"
|
62
|
+
end
|
63
|
+
|
64
|
+
porcentaje.each do |prc|
|
65
|
+
output << "VCT: #{prc[0]}"
|
66
|
+
output << ", Proteinas: #{prc[1]}"
|
67
|
+
output << ", Grasas: #{prc[2]}"
|
68
|
+
output << ", Hidratos: #{prc[3]}\n"
|
69
|
+
end
|
70
|
+
output
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
data/lib/Dieta.rb
ADDED
metadata
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: Dieta-alu0100818130
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Aduanich Rguez Rguez
|
8
|
+
- Alejandro Carrillo Padrón
|
9
|
+
autorequire:
|
10
|
+
bindir: exe
|
11
|
+
cert_chain: []
|
12
|
+
date: 2016-12-15 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: '"Desarollo TDD de la clase dieta utilizando Bundler"'
|
99
|
+
email:
|
100
|
+
- alu0100818130@ull.edu.es
|
101
|
+
- alu0100845808@ull.edu.es
|
102
|
+
executables: []
|
103
|
+
extensions: []
|
104
|
+
extra_rdoc_files: []
|
105
|
+
files:
|
106
|
+
- ".gitignore"
|
107
|
+
- ".travis.yml"
|
108
|
+
- Dieta.gemspec
|
109
|
+
- Gemfile
|
110
|
+
- Gemfile.lock
|
111
|
+
- Guardfile
|
112
|
+
- Rakefile
|
113
|
+
- bin/console
|
114
|
+
- bin/setup
|
115
|
+
- lib/Dieta.rb
|
116
|
+
- lib/Dieta/dgrpal.rb
|
117
|
+
- lib/Dieta/dgrpedad.rb
|
118
|
+
- lib/Dieta/dieta.rb
|
119
|
+
- lib/Dieta/lista.rb
|
120
|
+
- lib/Dieta/menu.rb
|
121
|
+
- lib/Dieta/version.rb
|
122
|
+
homepage: https://github.com/ULL-ESIT-LPP-1617/tdd-menu-equipo-10
|
123
|
+
licenses: []
|
124
|
+
metadata:
|
125
|
+
yard.run: yri
|
126
|
+
post_install_message:
|
127
|
+
rdoc_options: []
|
128
|
+
require_paths:
|
129
|
+
- lib
|
130
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
requirements: []
|
141
|
+
rubyforge_project:
|
142
|
+
rubygems_version: 2.5.1
|
143
|
+
signing_key:
|
144
|
+
specification_version: 4
|
145
|
+
summary: '"Clase Dieta"'
|
146
|
+
test_files: []
|