alu0100893861menu 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 69b120483bc8e0e04a704165264d69da99721201f68a8bed0225e051a6941304
4
+ data.tar.gz: 53e9a277241bf85ce9cc03c9bc073f1b34af630998ef36bbd74bc1e8d12bf9d8
5
+ SHA512:
6
+ metadata.gz: 2d4b3b12e8e3111f4ef41f61c6c1a6497eb1a2ed778aec040ce1e63bda13bf4bbf7770eae9ec65a4b880183c33076b4556a78568a4ac1e799db9429eb692b632
7
+ data.tar.gz: 73d3603ca6b3321f45747000df19031e345d6d56b4eeaaeae24ca6e8c509b665825295e461561b01a5303f3e4f996ad10cf54806efdc37200b0e2332f845067d
@@ -0,0 +1 @@
1
+ service_name: travis-ci
@@ -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/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.5.1
5
+ before_install: gem install bundler -v 1.16.2
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in gema.gemspec
6
+ gemspec
@@ -0,0 +1,111 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ alu0100893861menu (0.1.7)
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
+ alu0100893861menu!
102
+ bundler (~> 1.16)
103
+ coveralls
104
+ guard
105
+ guard-bundler
106
+ guard-rspec
107
+ rake (~> 10.0)
108
+ rspec (~> 3.0)
109
+
110
+ BUNDLED WITH
111
+ 1.16.2
@@ -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
@@ -0,0 +1,35 @@
1
+ # Gema
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/gema`. 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 'gema'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install gema
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]/gema.
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "gema"
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__)
@@ -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
@@ -0,0 +1,41 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "gema/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "alu0100893861menu"
8
+ spec.version = Gema::VERSION
9
+ spec.authors = ["alu0100893861"]
10
+ spec.email = ["alu0100893861@ull.edu.es"]
11
+
12
+ spec.summary = %q{"Nada"}
13
+ spec.description = %q{"Gema prc06"}
14
+ spec.homepage = "https://github.com/ULL-ESIT-LPP-1819/tdd-alu0100893861.git"
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://github.com/ULL-ESIT-LPP-1819/tdd-alu0100893861.git"
20
+ # else
21
+ # raise "RubyGems 2.0 or newer is required to protect against " \
22
+ # "public gem pushes."
23
+ # end
24
+
25
+ # Specify which files should be added to the gem when it is released.
26
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
27
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
28
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
29
+ end
30
+ spec.bindir = "exe"
31
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
32
+ spec.require_paths = ["lib"]
33
+
34
+ spec.add_development_dependency "bundler", "~> 1.16"
35
+ spec.add_development_dependency "rake", "~> 10.0"
36
+ spec.add_development_dependency "rspec", "~> 3.0"
37
+ spec.add_development_dependency "guard"
38
+ spec.add_development_dependency "guard-rspec"
39
+ spec.add_development_dependency "guard-bundler"
40
+ spec.add_development_dependency "coveralls"
41
+ end
@@ -0,0 +1,8 @@
1
+ require "gema/version"
2
+ require "gema/persona"
3
+ require "gema/lista"
4
+ require "benchmark"
5
+ require "gema/menu"
6
+ module Gema
7
+ # Your code goes here...
8
+ end
@@ -0,0 +1,50 @@
1
+ class Etiqueta
2
+ include Comparable
3
+ attr_reader :nombre, :grasa,:saturadas, :hidratos, :proteinas, :azucares, :sal, :valor_energetico, :porcion,:valor_porcion, :monoinsaturadas, :poliinsaturadas, :fibra_alimentaria, :polialcoholes, :almidon, :vit_min
4
+ def initialize(nombre,grasa,saturadas, hidratos, proteinas,azucares, sal,porcion, monoinsaturadas,poliinsaturadas,fibra_alimentaria,polialcoholes,almidon,vit_min)
5
+ @nombre=nombre
6
+ @grasa=grasa
7
+ @saturadas=saturadas
8
+ @hidratos=hidratos
9
+ @proteinas=proteinas
10
+ @azucares=azucares
11
+ @sal=sal
12
+ @fibra_alimentaria=fibra_alimentaria
13
+ @monoinsaturadas=monoinsaturadas
14
+ @poliinsaturadas=poliinsaturadas
15
+ @polialcoholes=polialcoholes
16
+ @almidon=almidon
17
+ @vit_min=vit_min
18
+ @valor_energetico=[v_energeticokJ,v_energeticokc]
19
+ @porcion=porcion/100
20
+ @valor_porcion=[porcion_kJ,porcion_kc]
21
+ @IR=[8400,2000,70,20,260,50,90,6]
22
+ end
23
+ def v_energeticokJ
24
+ (37.0*@grasa)+(17.0*@hidratos)+(17.0*@proteinas)+(25*@sal)
25
+ end
26
+ def v_energeticokc
27
+ (9.0*@grasa)+(4.0*@hidratos)+(4.0*@proteinas)+(6*@sal)
28
+ end
29
+ def porcion_kJ
30
+ v_energeticokJ*@porcion
31
+ end
32
+ def porcion_kc
33
+ v_energeticokc*@porcion
34
+ end
35
+ def gt_6?
36
+ if (@sal >= 6)
37
+ true
38
+ else
39
+ false
40
+ end
41
+ end
42
+ def <=>(other)
43
+ return nil unless other.instance_of?Etiqueta
44
+ @proteinas <=> other.proteinas
45
+ end
46
+ def to_s
47
+ "#{@proteinas}"
48
+ end
49
+ end
50
+
@@ -0,0 +1,44 @@
1
+ #create a struct with :value, :next and :prev
2
+ Node = Struct.new(:value, :next, :prev)
3
+ class Lista
4
+ include Enumerable
5
+ attr_reader :head, :tail
6
+ def initialize
7
+ @head=nil
8
+ @tail=nil
9
+ end
10
+ def empty?
11
+ @head==nil
12
+ @head==nil
13
+ end
14
+ def insert(value)
15
+ nodo = Node.new(value,nil,nil)
16
+ if empty?
17
+ @head=nodo
18
+ @tail=nodo
19
+ else
20
+ @tail.next=nodo
21
+ nodo.prev=@tail
22
+ @tail = nodo
23
+ end
24
+ end
25
+ def get_head
26
+ aux = @head
27
+ @head = @head.next
28
+ aux
29
+ end
30
+
31
+ def get_tail
32
+ aux = @tail
33
+ @tail = @tail.prev
34
+ aux
35
+ end
36
+ def each
37
+ it = @head
38
+ while it != nil
39
+ yield it.value
40
+ it=it.next
41
+ end
42
+ end
43
+ end
44
+
@@ -0,0 +1,114 @@
1
+ class Menu
2
+ attr_accessor :dia, :composicion, :titulo, :ingesta, :desayuno, :almuerzo, :cena, :v_energeticos
3
+
4
+ def initialize(dia, &block)
5
+ @dia = dia
6
+ @titulo = ""
7
+ @ingesta = []
8
+ @desayuno = []
9
+ @almuerzo = []
10
+ @cena = []
11
+ @v_energeticos = []
12
+ @v_totals = 0
13
+
14
+ if block_given?
15
+ if block.arity == 1
16
+ yield self
17
+ else
18
+ instance_eval(&block)
19
+ end
20
+ end
21
+ end
22
+
23
+ def to_s
24
+ output = @dia
25
+ output << "\n#{'=' * @dia.size}\n\n"
26
+ output << "Ingesta: #{@ingesta.join(' ')}\n\n"
27
+ output << "\n Desayuno:"
28
+
29
+ @desayuno.each do |i|
30
+ output << "\n #{i[:descripcion]}"
31
+ output << "\n #{i[:porcion]}"
32
+ output << "\n #{i[:gramos]}"
33
+ output << "\n #{i[:grasas]}"
34
+ output << "\n #{i[:carbohidratos]}"
35
+ output << "\n #{i[:proteinas]}"
36
+ output << "\n #{i[:fibra]}"
37
+ output << "\n #{i[:sal]}"
38
+ @v_energeticos = [i[:grasas]*36,i[:proteinas]*17,i[:carbohidratos]*17]
39
+ output << "\n Valor energetico: #{@v_energeticos.inject{|i,sum| sum+i}}"
40
+ end
41
+ output << "\n Almuerzo:"
42
+
43
+ @almuerzo.each do |i|
44
+ output << "\n #{i[:descripcion]}"
45
+ output << "\n #{i[:porcion]}"
46
+ output << "\n #{i[:gramos]}"
47
+ output << "\n #{i[:grasas]}"
48
+ output << "\n #{i[:carbohidratos]}"
49
+ output << "\n #{i[:proteinas]}"
50
+ output << "\n #{i[:fibra]}"
51
+ output << "\n #{i[:sal]}"
52
+ @v_energeticos = [i[:grasas]*36,i[:proteinas]*17,i[:carbohidratos]*17]
53
+ output << "\n Valor energetico: #{@v_energeticos.inject{|i,sum| sum+i}}"
54
+ end
55
+ output << "\n Cena:"
56
+
57
+ @cena.each do |i|
58
+ output << "\n #{i[:descripcion]}"
59
+ output << "\n #{i[:porcion]}"
60
+ output << "\n #{i[:gramos]}"
61
+ output << "\n #{i[:grasas]}"
62
+ output << "\n #{i[:carbohidratos]}"
63
+ output << "\n #{i[:proteinas]}"
64
+ output << "\n #{i[:fibra]}"
65
+ output << "\n #{i[:sal]}"
66
+ @v_energeticos = [i[:grasas]*36,i[:proteinas]*17,i[:carbohidratos]*17]
67
+ output << "\n Valor energetico: #{@v_energeticos.inject{|i,sum| sum+i}}"
68
+ end
69
+ output
70
+ end
71
+
72
+ def ingesta(name,options={})
73
+ ingesta = name
74
+ ingesta << "Min: #{options[:min]}" if options[:min]
75
+ ingesta << "Max: #{options[:max]}" if options[:max]
76
+ @ingesta << ingesta
77
+ end
78
+ def desayuno(name,options = {})
79
+ desayuno = name
80
+ desayuno << " (#{options[:descripcion]})" if options[:descripcion]
81
+ desayuno << " (#{options[:porcion]})" if options[:porcion]
82
+ desayuno << " (#{options[:gramos]})" if options[:gramos]
83
+ desayuno << " (#{options[:grasas]})" if options[:grasas]
84
+ desayuno << " (#{options[:carbohidratos]})" if options[:carbohidratos]
85
+ desayuno << " (#{options[:proteinas]})" if options[:proteinas]
86
+ desayuno << " (#{options[:fibra]})" if options[:fibra]
87
+ desayuno << " (#{options[:sal]})" if options[:sal]
88
+ @desayuno << desayuno
89
+ end
90
+ def almuerzo(name,options = {})
91
+ almuerzo = name
92
+ almuerzo << " (#{options[:descripcion]})" if options[:descripcion]
93
+ almuerzo << " (#{options[:porcion]})" if options[:porcion]
94
+ almuerzo << " (#{options[:gramos]})" if options[:gramos]
95
+ almuerzo << " (#{options[:grasas]})" if options[:grasas]
96
+ almuerzo << " (#{options[:carbohidratos]})" if options[:carbohidratos]
97
+ almuerzo << " (#{options[:proteinas]})" if options[:proteinas]
98
+ almuerzo << " (#{options[:fibra]})" if options[:fibra]
99
+ almuerzo << " (#{options[:sal]})" if options[:sal]
100
+ @almuerzo << almuerzo
101
+ end
102
+ def cena(name,options = {})
103
+ cena = name
104
+ cena << " (#{options[:descripcion]})" if options[:descripcion]
105
+ cena << " (#{options[:porcion]})" if options[:porcion]
106
+ cena << " (#{options[:gramos]})" if options[:gramos]
107
+ cena << " (#{options[:grasas]})" if options[:grasas]
108
+ cena << " (#{options[:carbohidratos]})" if options[:carbohidratos]
109
+ cena << " (#{options[:proteinas]})" if options[:proteinas]
110
+ cena << " (#{options[:fibra]})" if options[:fibra]
111
+ cena << " (#{options[:sal]})" if options[:sal]
112
+ @cena << cena
113
+ end
114
+ end
@@ -0,0 +1,74 @@
1
+ class Individuo
2
+ include Comparable
3
+ attr_reader :persona, :peso, :talla
4
+ def initialize(persona,peso,talla)
5
+ @persona=persona
6
+ @peso=peso
7
+ @talla=talla
8
+ end
9
+ def to_s
10
+ "#{@persona} #{@peso} #{@talla}"
11
+ end
12
+ def <=>(other)
13
+ return nil unless other.instance_of?Individuo
14
+ @peso <=> other.peso
15
+ end
16
+ end
17
+ class Paciente < Individuo
18
+ attr_reader :sexo, :edad
19
+ def initialize(persona,peso,talla,sexo,edad)
20
+ super(persona,peso,talla)
21
+ @sexo=sexo
22
+ @edad=edad
23
+ end
24
+ def imc
25
+ @peso / (@talla * @talla)
26
+ end
27
+
28
+ def tabla_imc
29
+ if(imc<18.5)
30
+ "Delgado"
31
+ elsif(imc>18.5 && imc < 25.0)
32
+ "Adecuado/Aceptable"
33
+ elsif(imc > 24.9 && imc < 30)
34
+ "Sobrepeso"
35
+ elsif(imc > 29.9 && imc < 35.0)
36
+ "Obesidad grado 1"
37
+ elsif(imc > 34.9 && imc < 40.0)
38
+ "Obesidad grado 2"
39
+ elsif(imc > 40.0)
40
+ "Obesidad grado 3"
41
+ end
42
+ end
43
+ def to_s
44
+ super.to_s "#{@edad}, #{@sexo}"
45
+ end
46
+ def teorico
47
+ (talla-150)*0.75+50
48
+ end
49
+ def gasto_basal
50
+ return ((10*@peso)+(6.25*@talla)-(5*@edad)+5).round(2) if @sexo == 1
51
+ ((10*@peso)+(6.25*@talla)-(5*@edad) - 161).round(2)
52
+ end
53
+ def efecto
54
+ (gasto_basal * 0.10).round(2)
55
+ end
56
+ def actividad_fisica(actividad)
57
+ return 0.0 if actividad == "Reposo"
58
+ return 0.12 if actividad == "Ligera"
59
+ return 0.27 if actividad == "Moderada"
60
+ return 0.54 if actividad == "Intensa"
61
+ end
62
+ def gasto_act_fisica(actividad)
63
+
64
+ (actividad_fisica(actividad) * gasto_basal).round(2)
65
+
66
+ end
67
+
68
+ def gasto_total(actividad)
69
+
70
+ (gasto_basal + efecto + actividad_fisica(actividad)).round(2)
71
+
72
+ end
73
+ end
74
+
@@ -0,0 +1,5 @@
1
+ require "gema/etiqueta_nutricional.rb"
2
+ require "gema/lista.rb"
3
+ module Gema
4
+ VERSION = "0.1.7"
5
+ end
metadata ADDED
@@ -0,0 +1,159 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: alu0100893861menu
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.7
5
+ platform: ruby
6
+ authors:
7
+ - alu0100893861
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-01-11 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.16'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
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
+ - !ruby/object:Gem::Dependency
98
+ name: coveralls
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: '"Gema prc06"'
112
+ email:
113
+ - alu0100893861@ull.edu.es
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".coveralls.yml"
119
+ - ".gitignore"
120
+ - ".rspec"
121
+ - ".travis.yml"
122
+ - Gemfile
123
+ - Gemfile.lock
124
+ - Guardfile
125
+ - README.md
126
+ - Rakefile
127
+ - bin/console
128
+ - bin/setup
129
+ - gema.gemspec
130
+ - lib/gema.rb
131
+ - lib/gema/etiqueta_nutricional.rb
132
+ - lib/gema/lista.rb
133
+ - lib/gema/menu.rb
134
+ - lib/gema/persona.rb
135
+ - lib/gema/version.rb
136
+ homepage: https://github.com/ULL-ESIT-LPP-1819/tdd-alu0100893861.git
137
+ licenses: []
138
+ metadata: {}
139
+ post_install_message:
140
+ rdoc_options: []
141
+ require_paths:
142
+ - lib
143
+ required_ruby_version: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - ">="
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
148
+ required_rubygems_version: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ requirements: []
154
+ rubyforge_project:
155
+ rubygems_version: 2.7.7
156
+ signing_key:
157
+ specification_version: 4
158
+ summary: '"Nada"'
159
+ test_files: []