practica7 0.3.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,114 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Top Level Namespace
8
+
9
+ &mdash; Documentation by YARD 0.9.5
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ pathId = "";
19
+ relpath = '';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="class_list.html"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="_index.html">Index</a> &raquo;
40
+
41
+
42
+ <span class="title">Top Level Namespace</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <iframe id="search_frame" src="class_list.html"></iframe>
63
+
64
+ <div id="content"><h1>Top Level Namespace
65
+
66
+
67
+
68
+ </h1>
69
+ <div class="box_info">
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+ </div>
82
+
83
+ <h2>Defined Under Namespace</h2>
84
+ <p class="children">
85
+
86
+
87
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Practica7.html" title="Practica7 (module)">Practica7</a></span>
88
+
89
+
90
+
91
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Diet.html" title="Diet (class)">Diet</a></span>, <span class='object_link'><a href="Dietedad.html" title="Dietedad (class)">Dietedad</a></span>, <span class='object_link'><a href="Diettipo.html" title="Diettipo (class)">Diettipo</a></span>, <span class='object_link'><a href="LinkedList.html" title="LinkedList (class)">LinkedList</a></span>, <span class='object_link'><a href="Node.html" title="Node (class)">Node</a></span>
92
+
93
+
94
+ </p>
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+ </div>
105
+
106
+ <div id="footer">
107
+ Generated on Tue Nov 22 23:11:07 2016 by
108
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
109
+ 0.9.5 (ruby-2.3.0).
110
+ </div>
111
+
112
+ </div>
113
+ </body>
114
+ </html>
Binary file
Binary file
@@ -0,0 +1,80 @@
1
+ require "practica7/version"
2
+ class Diet
3
+ attr_accessor :titulo,:nombre,:inges,:plat,:porcen,:percentage,:des_plato,:con_plato,:data,:vct
4
+ def initialize(nomb,&block)
5
+ self.nombre = nomb
6
+ self.titulo=""
7
+ self.inges=[]
8
+ self.plat=[]
9
+ self.porcen=[]
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
+ def title(name)
19
+ self.titulo=name
20
+ end
21
+ def ingesta(options={})
22
+ inges << " (#{options[:min]})" if options[:min]
23
+ inges << " (#{options[:max]})" if options[:max]
24
+ end
25
+ def plato(options={})
26
+ vec_plat = "(#{options[:descripcion]})" if options[:descripcion]
27
+ vec_plat << "(#{options[:porcion]})" if options[:porcion]
28
+ vec_plat << "(#{options[:gramos]})" if options[:gramos]
29
+ plat<<vec_plat
30
+ end
31
+ def porcentajes(options={})
32
+ porcen<<"(#{options[:vct]})" if options[:vct]
33
+ porcen<<"(#{options[:proteinas]})" if options[:proteinas]
34
+ porcen<<"(#{options[:grasas]})" if options[:grasas]
35
+ porcen<<"(#{options[:hidratos]})" if options[:hidratos]
36
+ end
37
+
38
+ def group_plates
39
+ s = "#{self.con_plato[0][0]}"
40
+ $i=1
41
+ while $i < self.con_plato.length do
42
+ s+= ", "
43
+ s+= "#{self.con_plato[$i][0]}"
44
+ $i+=1
45
+ end
46
+ s
47
+ end
48
+ def to_s
49
+ output= "\n\n#{self.nombre}"
50
+ output << "\n#{'=' * titulo.size}\n\n"
51
+ output << "Ingesta min:#{inges[0]} max:#{inges[1]}\n\n"
52
+ plat.each do |n|
53
+ output<<"#{n}\n"
54
+ end
55
+ output <<"\n\n"
56
+ output << "vct: #{porcen[0]} protinas: #{porcen[1]} grasas: #{porcen[2]} hidratos: #{porcen[3]}"
57
+ end
58
+ end
59
+
60
+ class Dietedad < Diet
61
+ def initialize(title,percentage,con_plato,vct,data,age)
62
+ super(title,percentage,con_plato,vct,data)
63
+ self.age=age
64
+ end
65
+ def to_s
66
+ print<<super.to_s
67
+ print<<" Age--> #{self.age}"
68
+ end
69
+ end
70
+
71
+ class Diettipo < Diet
72
+ def initialize(title,percentage,con_plato,vct,data,tipo)
73
+ super(title,percentage,con_plato,vct,data)
74
+ self.type=tipo
75
+ end
76
+ def to_s
77
+ print<<super.to_s
78
+ print<<" Age--> #{self.age}"
79
+ end
80
+ end
@@ -0,0 +1,38 @@
1
+ require "practica7/version"
2
+ Node = Struct.new(:value,:next,:prev)
3
+
4
+ class LinkedList
5
+ attr_accessor :head,:tail
6
+ include Enumerable
7
+ def initialize
8
+ @head = @tail = nil
9
+ end
10
+ def add(value)
11
+ node = Node.new(value)
12
+ @head = node if @head.nil?
13
+ @tail.next = node unless @tail.nil?
14
+ node.prev = @tail unless @tail.nil?
15
+ @tail = node
16
+ end
17
+ def pop
18
+ aux=@head
19
+ @head=@head.next
20
+ aux
21
+ end
22
+ def size
23
+ tam =0
24
+ aux=@head
25
+ while aux!=nil do
26
+ tam = tam + 1
27
+ aux=aux.next
28
+ end
29
+ tam
30
+ end
31
+ def each #:nodoc:
32
+ aux=@head
33
+ while aux!=nil do
34
+ yield aux.value
35
+ aux=aux.next
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,3 @@
1
+ module Practica7
2
+ VERSION = "0.3.0"
3
+ end
@@ -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 'practica7/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "practica7"
8
+ spec.version = Practica7::VERSION
9
+ spec.authors = ["Guillermo"]
10
+ spec.email = ["alu0100881677@ull.edu.es"]
11
+
12
+ spec.summary = %q{esto es la practica 8}
13
+ spec.description = %q{desarrollo de la practivca8 con herencia}
14
+ spec.homepage = "https://github.com/ULL-ESIT-LPP-1617/menu-dietetico-alu0100881677.git"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ #if spec.respond_to?(:metadata)
20
+ # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
21
+ #else
22
+ # raise "RubyGems 2.0 or newer is required to protect against " \
23
+ # "public gem pushes."
24
+ #end
25
+
26
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
+ f.match(%r{^(test|spec|features)/})
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+
33
+ spec.add_development_dependency "guard"
34
+ spec.add_development_dependency "guard-rspec"
35
+ spec.add_development_dependency "guard-bundler"
36
+ spec.add_development_dependency "bundler", "~> 1.13"
37
+ spec.add_development_dependency "rake", "~> 10.0"
38
+ spec.add_development_dependency "rspec", "~> 3.0"
39
+ end
metadata ADDED
@@ -0,0 +1,166 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: practica7
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ platform: ruby
6
+ authors:
7
+ - Guillermo
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-12-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: guard
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: guard-rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: guard-bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.13'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.13'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.0'
97
+ description: desarrollo de la practivca8 con herencia
98
+ email:
99
+ - alu0100881677@ull.edu.es
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".DS_Store"
105
+ - ".gitignore"
106
+ - ".rspec"
107
+ - ".travis.yml"
108
+ - CODE_OF_CONDUCT.md
109
+ - Gemfile
110
+ - Guardfile
111
+ - LICENSE.txt
112
+ - README.md
113
+ - Rakefile
114
+ - bin/console
115
+ - bin/setup
116
+ - documentation/Diet.html
117
+ - documentation/Dietedad.html
118
+ - documentation/Diettipo.html
119
+ - documentation/LinkedList.html
120
+ - documentation/Node.html
121
+ - documentation/Practica7.html
122
+ - documentation/_index.html
123
+ - documentation/class_list.html
124
+ - documentation/css/common.css
125
+ - documentation/css/full_list.css
126
+ - documentation/css/style.css
127
+ - documentation/file.README.html
128
+ - documentation/file_list.html
129
+ - documentation/frames.html
130
+ - documentation/index.html
131
+ - documentation/js/app.js
132
+ - documentation/js/full_list.js
133
+ - documentation/js/jquery.js
134
+ - documentation/method_list.html
135
+ - documentation/top-level-namespace.html
136
+ - lib/.DS_Store
137
+ - lib/practica7/.DS_Store
138
+ - lib/practica7/diet.rb
139
+ - lib/practica7/practica7.rb
140
+ - lib/practica7/version.rb
141
+ - practica7.gemspec
142
+ homepage: https://github.com/ULL-ESIT-LPP-1617/menu-dietetico-alu0100881677.git
143
+ licenses:
144
+ - MIT
145
+ metadata: {}
146
+ post_install_message:
147
+ rdoc_options: []
148
+ require_paths:
149
+ - lib
150
+ required_ruby_version: !ruby/object:Gem::Requirement
151
+ requirements:
152
+ - - ">="
153
+ - !ruby/object:Gem::Version
154
+ version: '0'
155
+ required_rubygems_version: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ requirements: []
161
+ rubyforge_project:
162
+ rubygems_version: 2.5.1
163
+ signing_key:
164
+ specification_version: 4
165
+ summary: esto es la practica 8
166
+ test_files: []