etiqueta 2.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 89f1d5715fd4d9dcb893ac942ebb9f6a53cfaea4
4
+ data.tar.gz: 812e671a52914ab99eff8f15002d8ed85ff5daa0
5
+ SHA512:
6
+ metadata.gz: 7b3c97885512c329c7bb6e2d9b02170eee56469c5486e889ddeb98756ac4bd900a72555cbd71b3770a79e1f2d455707e9ffd32048b07d2e5ff6e140bcaff39be
7
+ data.tar.gz: d2f2246aa0f186bb0fa3dfa109a213a57d520e24ced7aa9ca4d4fb7335d6866a6a66bdf294fbf9639ccc35b657d90864afde9dedb5546bb950dc97209bc9618b
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ sudo: false
3
+ before_install:
4
+ - cd etiqueta
5
+ rvm:
6
+ 2.4.0
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at daniel1305972@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source "https://rubygems.org"
2
+
3
+
4
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
5
+
6
+ # Specify your gem's dependencies in etiqueta.gemspec
7
+ gemspec
8
+ gem 'coveralls', require: false
9
+ gem 'rspec'
data/Gemfile.lock ADDED
@@ -0,0 +1,111 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ etiqueta (2.0.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ coderay (1.1.2)
10
+ coveralls (0.7.1)
11
+ multi_json (~> 1.3)
12
+ rest-client
13
+ simplecov (>= 0.7)
14
+ term-ansicolor
15
+ thor
16
+ diff-lcs (1.3)
17
+ docile (1.3.1)
18
+ domain_name (0.5.20180417)
19
+ unf (>= 0.0.5, < 1.0.0)
20
+ ffi (1.9.25)
21
+ formatador (0.2.5)
22
+ guard (2.15.0)
23
+ formatador (>= 0.2.4)
24
+ listen (>= 2.7, < 4.0)
25
+ lumberjack (>= 1.0.12, < 2.0)
26
+ nenv (~> 0.1)
27
+ notiffany (~> 0.0)
28
+ pry (>= 0.9.12)
29
+ shellany (~> 0.0)
30
+ thor (>= 0.18.1)
31
+ guard-bundler (2.1.0)
32
+ bundler (~> 1.0)
33
+ guard (~> 2.2)
34
+ guard-compat (~> 1.1)
35
+ guard-compat (1.2.1)
36
+ guard-rspec (4.7.3)
37
+ guard (~> 2.1)
38
+ guard-compat (~> 1.1)
39
+ rspec (>= 2.99.0, < 4.0)
40
+ http-cookie (1.0.3)
41
+ domain_name (~> 0.5)
42
+ json (2.1.0)
43
+ listen (3.1.5)
44
+ rb-fsevent (~> 0.9, >= 0.9.4)
45
+ rb-inotify (~> 0.9, >= 0.9.7)
46
+ ruby_dep (~> 1.2)
47
+ lumberjack (1.0.13)
48
+ method_source (0.9.2)
49
+ mime-types (3.2.2)
50
+ mime-types-data (~> 3.2015)
51
+ mime-types-data (3.2018.0812)
52
+ multi_json (1.13.1)
53
+ nenv (0.3.0)
54
+ netrc (0.11.0)
55
+ notiffany (0.1.1)
56
+ nenv (~> 0.1)
57
+ shellany (~> 0.0)
58
+ pry (0.12.2)
59
+ coderay (~> 1.1.0)
60
+ method_source (~> 0.9.0)
61
+ rake (10.5.0)
62
+ rb-fsevent (0.10.3)
63
+ rb-inotify (0.9.10)
64
+ ffi (>= 0.5.0, < 2)
65
+ rest-client (2.0.2)
66
+ http-cookie (>= 1.0.2, < 2.0)
67
+ mime-types (>= 1.16, < 4.0)
68
+ netrc (~> 0.8)
69
+ rspec (3.8.0)
70
+ rspec-core (~> 3.8.0)
71
+ rspec-expectations (~> 3.8.0)
72
+ rspec-mocks (~> 3.8.0)
73
+ rspec-core (3.8.0)
74
+ rspec-support (~> 3.8.0)
75
+ rspec-expectations (3.8.2)
76
+ diff-lcs (>= 1.2.0, < 2.0)
77
+ rspec-support (~> 3.8.0)
78
+ rspec-mocks (3.8.0)
79
+ diff-lcs (>= 1.2.0, < 2.0)
80
+ rspec-support (~> 3.8.0)
81
+ rspec-support (3.8.0)
82
+ ruby_dep (1.5.0)
83
+ shellany (0.0.1)
84
+ simplecov (0.16.1)
85
+ docile (~> 1.1)
86
+ json (>= 1.8, < 3)
87
+ simplecov-html (~> 0.10.0)
88
+ simplecov-html (0.10.2)
89
+ term-ansicolor (1.7.0)
90
+ tins (~> 1.0)
91
+ thor (0.20.3)
92
+ tins (1.20.2)
93
+ unf (0.1.4)
94
+ unf_ext
95
+ unf_ext (0.0.7.5)
96
+
97
+ PLATFORMS
98
+ ruby
99
+
100
+ DEPENDENCIES
101
+ bundler (~> 1.17)
102
+ coveralls
103
+ etiqueta!
104
+ guard
105
+ guard-bundler
106
+ guard-rspec
107
+ rake (~> 10.0)
108
+ rspec
109
+
110
+ BUNDLED WITH
111
+ 1.17.2
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.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
+
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) 2018 Daniel Rodríguez Suárez
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,43 @@
1
+ # Etiqueta
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/etiqueta`. 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 'etiqueta'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install etiqueta
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]/etiqueta. 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.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
+
41
+ ## Code of Conduct
42
+
43
+ Everyone interacting in the Etiqueta project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/etiqueta/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
7
+
8
+ desc "archivo para hacer las pruebas"
9
+ task :spec do
10
+ # sh "rspec -I. spec/individuo_spec.rb"
11
+ # sh "rspec -I. spec/dll_spec.rb"
12
+ # sh "rspec -I. spec/etiqueta_spec.rb"
13
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "etiqueta"
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
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/etiqueta.gemspec ADDED
@@ -0,0 +1,33 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "etiqueta/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "etiqueta"
8
+ spec.version = Etiqueta::VERSION
9
+ spec.authors = ["Daniel Rodríguez Suárez"]
10
+ spec.email = ["alu0100951615@ull.edu.es"]
11
+
12
+ spec.summary = %q{Write a short summary, because RubyGems requires one.}
13
+ spec.description = %q{Write a longer description or delete this line.}
14
+ spec.homepage = "https://github.com/ULL-ESIT-LPP-1819/tdd-alu0100951615"
15
+ spec.license = "MIT"
16
+
17
+ # Specify which files should be added to the gem when it is released.
18
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
20
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
+ end
22
+ spec.bindir = "exe"
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ["lib"]
25
+
26
+ spec.add_development_dependency "bundler", "~> 1.17"
27
+ spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "rspec", "~> 3.0"
29
+ spec.add_development_dependency "guard"
30
+ spec.add_development_dependency "guard-rspec"
31
+ spec.add_development_dependency "guard-bundler"
32
+
33
+ end
@@ -0,0 +1,98 @@
1
+ Node = Struct.new(:value, :next_, :prev)
2
+
3
+ class DLL
4
+
5
+ attr_reader :head, :tail
6
+
7
+ include Enumerable
8
+
9
+ def initialize(val)
10
+ @head = Node.new(val,nil,nil)
11
+ @tail = @head
12
+ end
13
+
14
+ def insert_tail(val)
15
+ aux = Node.new(val,nil,@tail)
16
+ @tail.next_ = aux
17
+ @tail = aux
18
+ end
19
+
20
+ def insert_head(val)
21
+ aux = Node.new(val,@head,nil)
22
+ @head.prev = aux
23
+ @head = aux
24
+ end
25
+
26
+ def extract_head
27
+ puntero = @head.value
28
+ @head = @head.next_
29
+ @head.prev = nil
30
+ return puntero
31
+ end
32
+
33
+ def extract_tail
34
+ puntero = @tail.value
35
+ @tail = @tail.prev
36
+ @tail.next_ = nil
37
+ return puntero
38
+ end
39
+ def to_s
40
+ string = "("
41
+ puntero = @head
42
+ while (puntero != nil) do
43
+ string += "#{puntero.value.getSal} gr,"
44
+ puntero = puntero.next_
45
+ end
46
+ string += ")"
47
+ return string
48
+ end
49
+
50
+ def clasificacion
51
+ puntero = @head
52
+ puntero2 = ""
53
+ cart = Array.new
54
+ while (puntero != nil) do
55
+ if (puntero.value.getSal <= 4)
56
+ puntero2 = "Bajo en Sal"
57
+ end
58
+ if (puntero.value.getSal > 4 && puntero.value.getSal <= 20)
59
+ puntero2 = "Medio en Sal"
60
+ end
61
+ if(puntero.value.getSal > 20)
62
+ puntero2 = "Alto en Sal"
63
+ end
64
+ cart.push(puntero.value.getNombre + "," + " " + puntero2)
65
+ puntero = puntero.next_
66
+ end
67
+ cart.sort
68
+ end
69
+
70
+ def clasificacionImc
71
+ aux = @head
72
+ cart = Array.new
73
+ while(aux != nil) do
74
+ if(aux.value.calculateimc < 18.5)
75
+ aux.value.valor = 'delgado'
76
+ end
77
+ if(aux.value.calculateimc >= 18.5 && aux.value.calculateimc < 24.9)
78
+ aux.value.valor = 'medio'
79
+ end
80
+ if(aux.value.calculateimc >= 24.9)
81
+ aux.value.valor = 'obeso'
82
+ end
83
+
84
+ cart.push(aux.value.nombre + "," + " " + aux.value.valor)
85
+ aux = aux.next_
86
+ end
87
+ cart.sort
88
+ end
89
+
90
+ def each(&block)
91
+ aux = @head
92
+ while(aux != nil) do
93
+ yield aux.value
94
+ aux = aux.next_
95
+ end
96
+ end
97
+
98
+ end
@@ -0,0 +1,195 @@
1
+ class Menu
2
+ attr_accessor :name, :ingredients, :instructions
3
+
4
+ def initialize(name, &block)
5
+ @desayuno_array = []
6
+ @almuerzo = []
7
+ @cena = []
8
+ @titulo
9
+ @ingesta = []
10
+ @name = name
11
+ @ingredients = []
12
+ @instructions = []
13
+ @valor_energetico = 0
14
+
15
+ if block_given?
16
+ if block.arity == 1
17
+ yield self
18
+ else
19
+ instance_eval(&block)
20
+ end
21
+ end
22
+ end
23
+
24
+ def to_s
25
+
26
+ puts @name
27
+ puts "\t \t \t Composición nutricional"
28
+ puts "\n#{'=' *100}\n\n"
29
+ puts "\t \t \t Grasa \t Carbohidratos \t Proteinas \t fibra \t sal \t valor energético \n \n "
30
+
31
+ @valor_total = 0
32
+
33
+ @desayuno_array.each do |elemento|
34
+ if elemento[:descripcion] == nil
35
+ elemento[:descripcion] = 0.00
36
+ end
37
+ if elemento[:fibra] == nil
38
+ elemento[:fibra] = 0.00
39
+ end
40
+ if elemento[:grasas] == nil
41
+ elemento[:grasas] = 0.00
42
+ end
43
+ if elemento[:carbohidratos] == nil
44
+ elemento[:carbohidratos] = 0.00
45
+ end
46
+ if elemento[:proteinas] == nil
47
+ elemento[:proteinas] = 0.00
48
+ end
49
+ if elemento[:sal] == nil
50
+ elemento[:sal] = 0.00
51
+ end
52
+ print elemento[:descripcion]
53
+ print "\t #{elemento[:grasas]}"
54
+ print "\t #{elemento[:carbohidratos]}"
55
+ print "\t \t #{elemento[:proteinas]}"
56
+ print "\t \t #{elemento[:fibra]}"
57
+ print "\t #{elemento[:sal]}"
58
+ print "\t #{@valor_energetico = (elemento[:grasas]*9 + elemento[:carbohidratos]*4 + elemento[:proteinas]*4 +elemento[:fibra]*2 + elemento[:sal]*6)/10}"
59
+ puts
60
+ @valor_total += @valor_energetico
61
+ end
62
+
63
+ @almuerzo.each do |elemento|
64
+ if elemento[:descripcion] == nil
65
+ elemento[:descripcion] = 0.00
66
+ end
67
+ if elemento[:fibra] == nil
68
+ elemento[:fibra] = 0.00
69
+ end
70
+ if elemento[:grasas] == nil
71
+ elemento[:grasas] = 0.00
72
+ end
73
+ if elemento[:carbohidratos] == nil
74
+ elemento[:carbohidratos] = 0.00
75
+ end
76
+ if elemento[:proteinas] == nil
77
+ elemento[:proteinas] = 0.00
78
+ end
79
+ if elemento[:sal] == nil
80
+ elemento[:sal] = 0.00
81
+ end
82
+
83
+ print "#{elemento[:descripcion]}"
84
+ print "\t \t #{elemento[:grasas]}"
85
+ print "\t #{elemento[:carbohidratos]}"
86
+ print "\t \t#{elemento[:proteinas]}"
87
+ print "\t \t#{elemento[:fibra]}"
88
+ print "\t #{elemento[:sal]}"
89
+ print "\t #{@valor_energetico = (elemento[:grasas]*9 + elemento[:carbohidratos]*4 + elemento[:proteinas]*4 +elemento[:fibra]*2 + elemento[:sal]*6)/10}"
90
+ puts
91
+ @valor_total += @valor_energetico
92
+ end
93
+
94
+ @cena.each do |elemento|
95
+ if elemento[:descripcion] == nil
96
+ elemento[:descripcion] = 0.00
97
+ end
98
+ if elemento[:fibra] == nil
99
+ elemento[:fibra] = 0.00
100
+ end
101
+ if elemento[:grasas] == nil
102
+ elemento[:grasas] = 0.00
103
+ end
104
+ if elemento[:carbohidratos] == nil
105
+ elemento[:carbohidratos] = 0.00
106
+ end
107
+ if elemento[:proteinas] == nil
108
+ elemento[:proteinas] = 0.00
109
+ end
110
+ if elemento[:sal] == nil
111
+ elemento[:sal] = 0.00
112
+ end
113
+ print elemento[:descripcion]
114
+ print " \t #{elemento[:grasas]}"
115
+ print " \t #{elemento[:carbohidratos]}"
116
+ print "\t \t #{elemento[:proteinas]}"
117
+ print "\t \t #{elemento[:fibra]}"
118
+ print "\t #{elemento[:sal]}"
119
+ print " \t #{@valor_energetico = (elemento[:grasas]*9 + elemento[:carbohidratos]*4 + elemento[:proteinas]*4 +elemento[:fibra]*2 + elemento[:sal]*6)/10}"
120
+ puts
121
+ @valor_total += @valor_energetico
122
+ end
123
+ print "Valor energético total #{@valor_total}"
124
+ puts
125
+ puts
126
+ puts
127
+ puts
128
+ puts
129
+ puts "\n#{'=' *100}\n\n"
130
+ end
131
+
132
+
133
+
134
+ def titulo(name)
135
+ @titulo = name
136
+ end
137
+
138
+
139
+
140
+ def ingesta(name,options = {})
141
+ ingesta = name
142
+ ingesta << "(#{options[:min]}" if options[:min]
143
+ ingesta << "(#{options[:max]}" if options[:max]
144
+
145
+ @ingesta << ingesta
146
+ end
147
+
148
+
149
+
150
+ def desayuno(name, options = {})
151
+ desayuno = name
152
+ desayuno << "(#{options[:descripcion]}" if options[:descripcion]
153
+ desayuno << "(#{options[:porcion]}" if options[:porcion]
154
+ desayuno << "(#{options[:grasas]}" if options[:grasas]
155
+ desayuno << "(#{options[:gramos]}" if options[:gramos]
156
+ desayuno << "(#{options[:carbohidratos]}" if options[:carbohidratos]
157
+ desayuno << "(#{options[:proteinas]}" if options[:proteinas]
158
+ desayuno << "(#{options[:fibra]}" if options[:fibra]
159
+ desayuno << "(#{options[:sal]}" if options[:sal]
160
+
161
+ @desayuno_array << desayuno
162
+
163
+ end
164
+
165
+
166
+ def almuerzo(name,options = {})
167
+ almuerzo = name
168
+ almuerzo << "(#{options[:descripcion]}" if options[:descripcion]
169
+ almuerzo << "(#{options[:porcion]}" if options[:porcion]
170
+ almuerzo << "(#{options[:grasas]}" if options[:grasas]
171
+ almuerzo << "(#{options[:carbohidratos]}" if options[:carbohidratos]
172
+ almuerzo << "(#{options[:proteinas]}" if options[:proteinas]
173
+ almuerzo << "(#{options[:fibra]}" if options[:fibra]
174
+ almuerzo << "(#{options[:sal]}" if options[:sal]
175
+
176
+ @almuerzo << almuerzo
177
+ end
178
+
179
+
180
+ def cena(name, options = {})
181
+ cena = name
182
+ cena << "(#{options[:descripcion]}" if options[:descripcion]
183
+ cena << "(#{options[:porcion]}" if options[:porcion]
184
+ cena << "(#{options[:gramo]}" if options[:gramo]
185
+ cena << "(#{options[:grasa]}" if options[:grasa]
186
+ cena << "(#{options[:proteina]}" if options[:proteina]
187
+ cena << "(#{options[:carbohidratos]}" if options[:carbohidratos]
188
+ cena << "(#{options[:sal]}" if options[:sal]
189
+
190
+ @cena << cena
191
+ end
192
+
193
+
194
+ end
195
+
@@ -0,0 +1,147 @@
1
+ class Individuo
2
+ attr_accessor :nombre,:edad,:sexo
3
+
4
+ def initialize(nombre,edad,sexo)
5
+ @edad = edad
6
+ @sexo = sexo
7
+ @nombre = nombre
8
+ end
9
+
10
+ def to_s()
11
+ return "Nombre :#{@nombre}, Edad #{@edad}, Sexo #{@sexo}, Lista #{@menu}"
12
+ end
13
+ end
14
+
15
+ class Paciente < Individuo
16
+
17
+ include Comparable
18
+
19
+ attr_accessor :nombre,:edad,:sexo,:peso,:talla,:porcentaje,:imc,:valor,:menu,:actFisica,:suma
20
+
21
+ def initialize(nombre,peso,talla,edad,sexo,porcentaje,imc,valor)
22
+ super(nombre,edad,sexo)
23
+ @nombre = nombre
24
+ @edad = edad
25
+ @sexo = sexo
26
+ @peso = peso
27
+ @talla = talla
28
+ @porcentaje = porcentaje
29
+ @imc = imc
30
+ @valor = valor
31
+ end
32
+
33
+ def addMenu(menu)
34
+ @menu = menu
35
+ end
36
+
37
+ def addactFisica(actFisica)
38
+ @actFisica = actFisica
39
+ end
40
+
41
+ def getPesoIdeal
42
+ return (talla - 150) * 0.75 + 50
43
+ end
44
+
45
+ def getGastoBasal
46
+ if sexo == "Mujer"
47
+ return (10 * peso) + (6.25 * talla) - (5 * edad) - 161
48
+ else
49
+ return (10 * peso) + (6.25 * talla) - (5 * edad) + 5
50
+ end
51
+ end
52
+
53
+ def getGastoTermogeno
54
+ return getGastoBasal * 0.10
55
+ end
56
+
57
+ def getGastoActividadFisica
58
+ return getGastoBasal * @actFisica
59
+ end
60
+
61
+ def getGastoTotal
62
+ return getGastoBasal + getGastoTermogeno + getGastoActividadFisica
63
+ end
64
+
65
+
66
+ def calculoAlimentacion
67
+ @suma = 0
68
+ @menu.each do |elemento|
69
+ @suma = @suma + elemento.calculate_Kcal
70
+
71
+ end
72
+ if (@suma >= getGastoTotal)
73
+ if (@suma - getGastoTotal <= getGastoTotal * 0.10)
74
+ valoracionfinal = "Menu adecuado"
75
+ else
76
+ valoracionfinal = "Menu no adecuado"
77
+ end
78
+ else
79
+ if getGastoTotal - @suma <= @suma * 0.10
80
+ valoracionfinal = "Menu adecuado"
81
+ else
82
+ valoracionfinal = "Menu no adecuado"
83
+ end
84
+ end
85
+ return valoracionfinal
86
+ end
87
+
88
+ def calculoValoracionNutricional
89
+ @suma = 0
90
+ @menu.each do |elemento|
91
+ elemento.each do |elemento2|
92
+ @suma = @suma + elemento2.calculate_Kcal
93
+ end
94
+
95
+ end
96
+ if (@suma >= getGastoTotal)
97
+ if (@suma - getGastoTotal <= getGastoTotal * 0.10)
98
+ valoracionfinal = "Menu adecuado"
99
+ else
100
+ valoracionfinal = "Menu no adecuado"
101
+ end
102
+ else
103
+ if getGastoTotal - @suma <= @suma * 0.10
104
+ valoracionfinal = "Menu adecuado"
105
+ else
106
+ valoracionfinal = "Menu no adecuado"
107
+ end
108
+ end
109
+ return valoracionfinal
110
+ end
111
+
112
+
113
+ def <=>(other)
114
+ [self.nombre,self.peso,self.talla,self.edad,self.sexo,self.porcentaje,self.imc,self.valor] <=> [other.nombre,other.peso,other.talla,other.edad,other.sexo,other.porcentaje,other.imc,other.valor]
115
+ end
116
+
117
+ def calculateimc
118
+ @imc = peso/(talla*talla)
119
+ return @imc
120
+ end
121
+
122
+ def calculatePorcentaje
123
+ if sexo == "Hombre"
124
+ sexo = 1
125
+ else
126
+ sexo = 0
127
+ end
128
+
129
+ porcentaje = 1.2 * @imc + 0.23 * edad - 10.8 * sexo - 5.4
130
+
131
+ if @imc < 18.5
132
+ @valor = 'flaco'
133
+ else if @imc < 24.9
134
+ @valor = 'medio'
135
+ else
136
+ @valor = 'obeso'
137
+ end
138
+ end
139
+ return porcentaje
140
+ end
141
+
142
+ def to_s()
143
+ return "Nombre: #{@nombre}, Peso: #{@peso}, Talla: #{@talla}, Edad: #{@edad}, Sexo: #{@sexo}, IMC: #{@imc}, Porcentaje: #{@porcentaje}, Complexión: #{@valor}"
144
+ end
145
+
146
+ end
147
+
@@ -0,0 +1,94 @@
1
+ class Info_nutri
2
+
3
+ include Comparable
4
+
5
+ attr_accessor :nombre,:calorias, :grasas, :grasa_saturada, :hidratos_carbono, :azucares, :proteina, :sal, :monoinsaturadas, :poliinsaturadas, :polialcoholes, :almidon, :fibra, :vitaminas, :porciones, :gramos
6
+ def initialize(nombre,calorias,grasas,grasa_saturada,hidratos_carbono,azucares,proteina,sal,monoinsaturadas,poliinsaturadas,polialcoholes,almidon,fibra,vitaminas,porciones,gramos)
7
+ self.nombre = nombre
8
+ self.calorias = calorias
9
+ self.grasas = grasas
10
+ self.grasa_saturada = grasa_saturada
11
+ self.hidratos_carbono = hidratos_carbono
12
+ self.azucares = azucares
13
+ self.proteina = proteina
14
+ self.sal = sal
15
+ self.monoinsaturadas = monoinsaturadas
16
+ self.poliinsaturadas = poliinsaturadas
17
+ self.polialcoholes = polialcoholes
18
+ self.almidon = almidon
19
+ self.fibra = fibra
20
+ self.vitaminas = vitaminas
21
+ self.porciones = porciones
22
+ self.gramos = gramos
23
+ end
24
+
25
+ def <=>(other)
26
+ [self.nombre,self.calorias,self.grasas,self.grasa_saturada,self.hidratos_carbono,self.azucares,self.proteina,self.sal,self.monoinsaturadas,self.poliinsaturadas,self.polialcoholes,self.almidon,self.fibra,self.vitaminas,self.porciones,self.gramos] <=> [other.nombre,other.calorias,other.grasas,other.grasa_saturada,other.hidratos_carbono,other.azucares,other.proteina,other.sal,other.monoinsaturadas,other.poliinsaturadas,other.polialcoholes,other.almidon,other.fibra,other.vitaminas,other.porciones,other.gramos]
27
+ end
28
+
29
+ def calculate_Julios
30
+ return (37*grasas + 37*monoinsaturadas + 37*poliinsaturadas + 17*hidratos_carbono + 17*azucares + 10*polialcoholes + 17*almidon + 8*fibra + 17*proteina + 25*sal)*porciones
31
+ end
32
+
33
+ def calculate_Kcal
34
+ return (9*grasas + 9*monoinsaturadas + 9*poliinsaturadas + 4*hidratos_carbono + 4*azucares + 2.4*polialcoholes + 4*almidon + 2*fibra + 4*proteina + 6*sal)*porciones
35
+ end
36
+
37
+ def getNombre
38
+ return @nombre
39
+ end
40
+
41
+ def getCalorias
42
+ return @calorias
43
+ end
44
+
45
+ def getGrasas
46
+ return @grasas
47
+ end
48
+
49
+ def getGrasasSaturadas
50
+ return @grasa_saturada
51
+ end
52
+
53
+ def getHidratos
54
+ return @hidratos_carbono
55
+ end
56
+
57
+ def getAzucares
58
+ return @azucares
59
+ end
60
+
61
+ def getProteinas
62
+ return @proteina
63
+ end
64
+
65
+ def getSal
66
+ return @sal
67
+ end
68
+
69
+ def getMonoInsaturada
70
+ return @monoinsaturadas
71
+ end
72
+
73
+ def getPoliinsaturada
74
+ return @poliinsaturadas
75
+ end
76
+
77
+ def getPolialcoholes
78
+ return @polialcoholes
79
+ end
80
+
81
+ def getAlmidon
82
+ return @almidon
83
+ end
84
+
85
+ def getFibra
86
+ return @fibra
87
+ end
88
+
89
+ def getVitamina
90
+ return @vitaminas
91
+ end
92
+
93
+
94
+ end
@@ -0,0 +1,3 @@
1
+ module Etiqueta
2
+ VERSION = "2.0.0"
3
+ end
data/lib/etiqueta.rb ADDED
@@ -0,0 +1,10 @@
1
+ require "etiqueta/version"
2
+ require "etiqueta/Info_nutri.rb"
3
+ require "etiqueta/Individuo.rb"
4
+ require "etiqueta/DLL.rb"
5
+ require "etiqueta/DSL.rb"
6
+
7
+ module Etiqueta
8
+ class Error < StandardError; end
9
+ # Your code goes here...
10
+ end
metadata ADDED
@@ -0,0 +1,147 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: etiqueta
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Daniel Rodríguez Suárez
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-01-09 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.17'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.17'
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: Write a longer description or delete this line.
98
+ email:
99
+ - alu0100951615@ull.edu.es
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".coveralls.yml"
105
+ - ".gitignore"
106
+ - ".travis.yml"
107
+ - CODE_OF_CONDUCT.md
108
+ - Gemfile
109
+ - Gemfile.lock
110
+ - Guardfile
111
+ - LICENSE.txt
112
+ - README.md
113
+ - Rakefile
114
+ - bin/console
115
+ - bin/setup
116
+ - etiqueta.gemspec
117
+ - lib/etiqueta.rb
118
+ - lib/etiqueta/DLL.rb
119
+ - lib/etiqueta/DSL.rb
120
+ - lib/etiqueta/Individuo.rb
121
+ - lib/etiqueta/Info_nutri.rb
122
+ - lib/etiqueta/version.rb
123
+ homepage: https://github.com/ULL-ESIT-LPP-1819/tdd-alu0100951615
124
+ licenses:
125
+ - MIT
126
+ metadata: {}
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.6.8
144
+ signing_key:
145
+ specification_version: 4
146
+ summary: Write a short summary, because RubyGems requires one.
147
+ test_files: []