nutrientes 0.1.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.
Files changed (55) hide show
  1. checksums.yaml +7 -0
  2. data/.coveralls.yml +1 -0
  3. data/.gitignore +13 -0
  4. data/.rspec +2 -0
  5. data/.travis.yml +7 -0
  6. data/Gemfile +6 -0
  7. data/Guardfile +82 -0
  8. data/README.md +31 -0
  9. data/Rakefile +6 -0
  10. data/bin/benchmark.rb +35 -0
  11. data/bin/console +15 -0
  12. data/bin/setup +8 -0
  13. data/docs/Alimento.html +867 -0
  14. data/docs/AlimentoGraso.html +146 -0
  15. data/docs/AlimentoRicoCarbohidratos.html +146 -0
  16. data/docs/Bebida.html +146 -0
  17. data/docs/DerivadoCarne.html +146 -0
  18. data/docs/Fruta.html +146 -0
  19. data/docs/HuevoLacteoHelado.html +146 -0
  20. data/docs/Lista.html +921 -0
  21. data/docs/Nodo.html +398 -0
  22. data/docs/Nutrientes.html +117 -0
  23. data/docs/PescadoMarisco.html +146 -0
  24. data/docs/VerduraHortaliza.html +146 -0
  25. data/docs/_index.html +229 -0
  26. data/docs/class_list.html +51 -0
  27. data/docs/css/common.css +1 -0
  28. data/docs/css/full_list.css +58 -0
  29. data/docs/css/style.css +492 -0
  30. data/docs/file.README.html +115 -0
  31. data/docs/file_list.html +56 -0
  32. data/docs/frames.html +17 -0
  33. data/docs/index.html +115 -0
  34. data/docs/js/app.js +248 -0
  35. data/docs/js/full_list.js +216 -0
  36. data/docs/js/jquery.js +4 -0
  37. data/docs/method_list.html +203 -0
  38. data/docs/top-level-namespace.html +112 -0
  39. data/lib/nutrientes/alimento.rb +55 -0
  40. data/lib/nutrientes/alimento_graso.rb +2 -0
  41. data/lib/nutrientes/alimento_rico_carbohidratos.rb +2 -0
  42. data/lib/nutrientes/array.rb +23 -0
  43. data/lib/nutrientes/bebida.rb +2 -0
  44. data/lib/nutrientes/derivado_carne.rb +2 -0
  45. data/lib/nutrientes/fruta.rb +2 -0
  46. data/lib/nutrientes/huevo_lacteo_helado.rb +2 -0
  47. data/lib/nutrientes/lista.rb +91 -0
  48. data/lib/nutrientes/nodo.rb +1 -0
  49. data/lib/nutrientes/pescado_marisco.rb +2 -0
  50. data/lib/nutrientes/plato.rb +128 -0
  51. data/lib/nutrientes/verdura_hortaliza.rb +2 -0
  52. data/lib/nutrientes/version.rb +3 -0
  53. data/lib/nutrientes.rb +18 -0
  54. data/nutrientes.gemspec +40 -0
  55. metadata +209 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 160c7c95d9e3598a6965c0510462f745be410a9c
4
+ data.tar.gz: 704d64e8f66e1782cc6746e10dbabc849b30d9fd
5
+ SHA512:
6
+ metadata.gz: a6c978d285151b50df838fc0a1affd448ebdcfc4f27420739729c437f05fe85e57732ecad354bdb27b37cd5affa3e485beca397d70a1e6da36ef8e4abf56b9e4
7
+ data.tar.gz: 12cd4b6b84dd9212152a05e65910aa77efc2edc7c6921ed6706de1514c1bb4f4cfbb2ff1e363f9635f0fd81be21aa557f3382ef3c3b4ae8e9ca6fd0249de9163
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /.idea/
11
+
12
+ # rspec failure tracking
13
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.0
5
+ - 2.4.2
6
+ - 2.0.0
7
+ before_install: gem install bundler -v 1.15.4
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 nutrientes.gemspec
6
+ gemspec
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,31 @@
1
+ # Nutrientes
2
+
3
+ Practica 10 de la asignatura Lenguajes y Paradigmas de Programación.
4
+
5
+ Esta gema es capaz de calcular el valor energético de alimentos en base a su cantidad de proteínas, glúcidos y lípidos.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'nutrientes'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install nutrientes
22
+
23
+ ## Development
24
+
25
+ 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.
26
+
27
+ 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).
28
+
29
+ ## Contributing
30
+
31
+ Bug reports and pull requests are welcome on GitHub at https://github.com/ULL-ESIT-LPP-1718/tdd-alu0101070650.git.
data/Rakefile ADDED
@@ -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
data/bin/benchmark.rb ADDED
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "nutrientes"
5
+ require "benchmark"
6
+ include Benchmark
7
+
8
+ alimentos = [HuevoLacteoHelado.new("Huevo frito", 14.1, 0, 19.5),
9
+ HuevoLacteoHelado.new("Leche vaca", 3.3, 4.8, 3.2),
10
+ HuevoLacteoHelado.new("Yogurt", 3.8, 4.9, 3.8),
11
+ DerivadoCarne.new("Cerdo", 21.5, 0, 6.3),
12
+ DerivadoCarne.new("Ternera", 21.1, 0, 3.1),
13
+ DerivadoCarne.new("Pollo", 20.6, 0, 5.6),
14
+ PescadoMarisco.new("Bacalao", 17.7, 0, 0.4),
15
+ PescadoMarisco.new("Atún", 21.5, 0, 15.5),
16
+ PescadoMarisco.new("Salmón", 19.9, 0, 13.6),
17
+ AlimentoGraso.new("Aceite de oliva", 0, 0.2, 99.6),
18
+ AlimentoGraso.new("Mantequilla", 0.7, 0, 83.2),
19
+ AlimentoGraso.new("Chocolate", 5.3, 47, 30),
20
+ AlimentoRicoCarbohidratos.new("Azúcar", 0, 99.8, 0),
21
+ AlimentoRicoCarbohidratos.new("Arroz", 6.8, 77.7, 0.6),
22
+ AlimentoRicoCarbohidratos.new("Lentejas", 23.5, 52.0, 1.4),
23
+ AlimentoRicoCarbohidratos.new("Papas", 2, 15.4, 0.1),
24
+ VerduraHortaliza.new("Tomate", 1, 3.5, 0.2),
25
+ VerduraHortaliza.new("Cebolla", 1.3, 5.8, 0.3),
26
+ VerduraHortaliza.new("Calabaza", 1.1, 4.8, 0.1),
27
+ Fruta.new("Manzana", 0.3, 12.4, 0.4),
28
+ Fruta.new("Plátanos", 1.2, 21.4, 0.2),
29
+ Fruta.new("Pera", 0.5, 12.7, 0.3)]
30
+
31
+ Benchmark.bmbm do |x|
32
+ x.report("sort_for") {alimentos.sort_for}
33
+ x.report("sort_each") {alimentos.sort_each}
34
+ x.report("sort") {alimentos.sort}
35
+ end
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "nutrientes"
5
+
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ 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