Dieta0100845808 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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 511d7aa8046755e1dae9b092900cd267fa4b669b
4
+ data.tar.gz: 7438cf107defef079f2d3ba299d56c38e260bb14
5
+ SHA512:
6
+ metadata.gz: 0f717c0f06afd4cfc6eaeeb879a5b0f674611a13cdc2717a924432c848261e948903c0d0fe7e6d9831606cb3abbd8ce8b08532519fa1f20583f4f225bc1fefca
7
+ data.tar.gz: ba6946abd5539324c4d26f7366652eaf010bda6098c968313363f3a97e3652f1665033bb12365c2e8f91da8bacc288cb5927798b5739fa014a40ce8cce0338fb
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.0
5
+ before_install: gem install bundler -v 1.13.6
@@ -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 'Dieta/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "Dieta0100845808"
8
+ spec.version = Dietas::VERSION
9
+ spec.authors = ["Alejandro Carrillo"]
10
+ spec.email = ["alu0100845808@ull.edu.es"]
11
+
12
+ spec.summary = %q{"Modulos"}
13
+ spec.homepage = "http://www.ull.es"
14
+
15
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
16
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
17
+ #if spec.respond_to?(:metadata)
18
+ # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
19
+ #else
20
+ #raise "RubyGems 2.0 or newer is required to protect against " \
21
+ # "public gem pushes."
22
+ #end
23
+
24
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
25
+ f.match(%r{^(test|spec|features)/})
26
+ end
27
+ spec.bindir = "exe"
28
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
+ spec.require_paths = ["lib"]
30
+
31
+ spec.add_development_dependency "bundler", "~> 1.13"
32
+ spec.add_development_dependency "rake", "~> 10.0"
33
+ spec.add_development_dependency "rspec", "~> 3.0"
34
+ spec.add_development_dependency "guard"
35
+ spec.add_development_dependency "guard-rspec"
36
+ spec.add_development_dependency "guard-bundler"
37
+ spec.metadata["yard.run"] = "yri"
38
+ end
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in Dieta.gemspec
4
+ gem 'guard'
5
+ gem 'yard'
6
+ gemspec
@@ -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
@@ -0,0 +1,36 @@
1
+ # Dieta
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/Dieta`. 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 'Dieta'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install Dieta
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]/Dieta.
36
+
@@ -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
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "Dieta"
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
@@ -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,10 @@
1
+ require "Dieta/version"
2
+ require "Dieta/LList"
3
+ require "Dieta/Dieta"
4
+ require "Dieta/Pgda"
5
+ require "Dieta/Pgde"
6
+ require "Dieta/Menu"
7
+
8
+ module Dietas
9
+ # Your code goes here...
10
+ end
@@ -0,0 +1,24 @@
1
+ class Dieta
2
+ include Comparable
3
+ attr_accessor :titulo,:porcmenu,:desc_platos,:por_platos,:gr_platos,:vct,:porcprot,:porcgrasas,:porchidratos
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
+ def <=> (other)
17
+ if(@gr_platos == other.gr_platos)
18
+ @porcprot <=> other.porcprot
19
+ else
20
+ @gr_platos <=> other.gr_platos
21
+ end
22
+ end
23
+
24
+ end
@@ -0,0 +1,90 @@
1
+ Node = Struct.new(:value, :next,:back)
2
+ class LList
3
+ # Clase lista
4
+ include Enumerable
5
+ attr_accessor :head, :tail
6
+
7
+
8
+ def initialize(perry)
9
+ a=Node.new(perry,nil,nil)
10
+ @head=a
11
+ @tail=a
12
+ end
13
+ #Introduce al inicio
14
+ def pushb(value)
15
+ if @head==nil
16
+ a=Node.new(value,nil,nil)
17
+ @head=a
18
+ @tail=@head
19
+ else
20
+ a=Node.new(value,@head,nil)
21
+ @head.back=a
22
+ @head=a
23
+ end
24
+
25
+ end
26
+ #Introduce al final
27
+ def pushe(value)
28
+ if @tail==nil
29
+ a=Node.new(value,nil,nil)
30
+ @head=a
31
+ @tail=@head
32
+ else
33
+ a=Node.new(value,nil,@tail)
34
+ @tail.next=a
35
+ @tail=a
36
+ end
37
+ end
38
+ #saca por el principio
39
+ def popb()
40
+ if @head==nil
41
+ @head=nil
42
+ @tail=nil
43
+ return nil
44
+ else
45
+ a=@head
46
+ @head=@head.next
47
+ return a.value
48
+ end
49
+
50
+ end
51
+ #saca por el final
52
+ def pope
53
+ if @tail==nil
54
+ @head=nil
55
+ @tail=nil
56
+ return nil
57
+ else
58
+ a=@tail
59
+ @tail=@tail.back
60
+ return a.value
61
+ end
62
+ end
63
+
64
+
65
+ def shownext
66
+ if @head.next==nil
67
+ return nil
68
+ else
69
+ return @head.next.value
70
+ end
71
+ end
72
+
73
+ def actual
74
+ if @head==nil
75
+ return nil
76
+ else
77
+ return @head.value
78
+ end
79
+ end
80
+
81
+
82
+ def each()
83
+ a=@head
84
+ while a!=nil
85
+ yield a.value
86
+ a=a.next
87
+ end
88
+ end
89
+
90
+ end
@@ -0,0 +1,63 @@
1
+ class Menu
2
+ attr_accessor :etiqueta , :title , :ingest , :platos, :porcentaje
3
+
4
+ def initialize(etiqueta,&block)
5
+ self.etiqueta=etiqueta
6
+ self.title = ""
7
+ self.ingest = []
8
+ self.platos = []
9
+ self.porcentaje = []
10
+ if block_given?
11
+ if block.arity == 1
12
+ yield self
13
+ else
14
+ instance_eval(&block)
15
+ end
16
+ end
17
+ end
18
+
19
+
20
+ def titulo(options = {})
21
+ title << "#{options[:titulo]}"
22
+ end
23
+
24
+ def ingesta(options = {})
25
+ ingest << "#{options[:min]}"
26
+ ingest << "#{options[:max]}"
27
+ end
28
+
29
+ def plato(options = {})
30
+ plat = []
31
+ plat << "#{options[:descripcion]}"
32
+ plat << "#{options[:porcion]}"
33
+ plat << "#{options[:gramos]}"
34
+ platos << plat
35
+ end
36
+ def porcentajes(options = {})
37
+ porcentaje << "#{options[:vct]}"
38
+ porcentaje << "#{options[:proteinas]}"
39
+ porcentaje << "#{options[:grasas]}"
40
+ porcentaje << "#{options[:hidratos]}"
41
+ end
42
+
43
+ def to_s
44
+ output = "#{title}\n"
45
+ output << "#{'#' * title.size}\n\n"
46
+ output << "Entre{"
47
+ ingest.each do |p|
48
+ output << p + " "
49
+ end
50
+ output << "}\n"
51
+ platos.each do |p|
52
+ p.each do |x|
53
+ output << x + " "
54
+ end
55
+ output << "g \n"
56
+ end
57
+ porcentaje.each do |p|
58
+ output << p + " "
59
+ end
60
+ output
61
+ end
62
+
63
+ end
@@ -0,0 +1,9 @@
1
+ require "Dieta"
2
+ class Pgda < Dieta
3
+ attr_accessor :pgd
4
+ def initialize(titulo,porcmenu,desc_platos,por_platos,gr_platos,vct,porcprot,porcgrasas,porchidratos,pdg)
5
+ super(titulo,porcmenu,desc_platos,por_platos,gr_platos,vct,porcprot,porcgrasas,porchidratos)
6
+ @pgd=pgd
7
+ end
8
+
9
+ end
@@ -0,0 +1,9 @@
1
+ require "Dieta"
2
+ class Pgde < Dieta
3
+ attr_accessor :pgd
4
+ def initialize(titulo,porcmenu,desc_platos,por_platos,gr_platos,vct,porcprot,porcgrasas,porchidratos,pdg)
5
+ super(titulo,porcmenu,desc_platos,por_platos,gr_platos,vct,porcprot,porcgrasas,porchidratos)
6
+ @pgd=pgd
7
+ end
8
+
9
+ end
@@ -0,0 +1,3 @@
1
+ module Dietas
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,144 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: Dieta0100845808
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Alejandro Carrillo
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-12-16 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.13'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.13'
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:
98
+ email:
99
+ - alu0100845808@ull.edu.es
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - ".travis.yml"
106
+ - Dieta.gemspec
107
+ - Gemfile
108
+ - Guardfile
109
+ - README.md
110
+ - Rakefile
111
+ - bin/console
112
+ - bin/setup
113
+ - lib/Dieta.rb
114
+ - lib/Dieta/Dieta.rb
115
+ - lib/Dieta/LList.rb
116
+ - lib/Dieta/Menu.rb
117
+ - lib/Dieta/Pgda.rb
118
+ - lib/Dieta/Pgde.rb
119
+ - lib/Dieta/version.rb
120
+ homepage: http://www.ull.es
121
+ licenses: []
122
+ metadata:
123
+ yard.run: yri
124
+ post_install_message:
125
+ rdoc_options: []
126
+ require_paths:
127
+ - lib
128
+ required_ruby_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ required_rubygems_version: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ requirements: []
139
+ rubyforge_project:
140
+ rubygems_version: 2.6.8
141
+ signing_key:
142
+ specification_version: 4
143
+ summary: '"Modulos"'
144
+ test_files: []