Bibliografia_alu0100502107 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +11 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/Guardfile +82 -0
- data/LICENSE.txt +21 -0
- data/README.md +7 -0
- data/Rakefile +12 -0
- data/bibliografia.gemspec +37 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/bibliografia.rb +8 -0
- data/lib/bibliografia/bibliografia.rb +331 -0
- data/lib/bibliografia/cita.rb +0 -0
- data/lib/bibliografia/lista_enlazada.rb +87 -0
- data/lib/bibliografia/version.rb +4 -0
- metadata +160 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: abb2aa844662a9398afad7125cef565bf0063dde
|
4
|
+
data.tar.gz: 67666cee9090a30b2af4e29eae7e67458314a0b1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e7a2bd56e4ca9404687df62ab7b761616e308afe21154c09c5fab75493d2a956bc5d7c0e5088b0bdb88684029482882d3539a217da8a3e2a945553008494887e
|
7
|
+
data.tar.gz: e60c3c8f477fa04eb4248bf04b9ff8e3f4c690c4c38a62cf270d9190ca035a86dda76f708c299030df47f3a3d2ee7ce5bf8d2f7779a59e04bf8a1fb81bbbddcb
|
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
service_name: travis-ci
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
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.("routing/#{m[1]}_routing"),
|
63
|
+
rspec.spec.("controllers/#{m[1]}_controller"),
|
64
|
+
rspec.spec.("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.("features/#{m[1]}") }
|
75
|
+
watch(rails.layouts) { |m| rspec.spec.("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) 2015 alu0100502107
|
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,7 @@
|
|
1
|
+
[![Coverage Status](https://coveralls.io/repos/alu0100502107/prct11/badge.svg?branch=vane%2Fdev&service=github)](https://coveralls.io/github/alu0100502107/prct11?branch=vane%2Fdev)
|
2
|
+
## Lenguajes y Paradigmas de Programación
|
3
|
+
|
4
|
+
### Práctica de Laboratorio #11. Lenguajes de Dominio Específico (DSL - Domain Specific Languages).
|
5
|
+
|
6
|
+
### Autora: Vanessa Marín Barella (vaneMB)
|
7
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'bibliografia/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "Bibliografia_alu0100502107"
|
8
|
+
spec.version = Bibliografia::VERSION
|
9
|
+
spec.authors = ["alu0100502107"]
|
10
|
+
spec.email = ["alu0100502107@ull.edu.es"]
|
11
|
+
|
12
|
+
spec.summary = %q{Práctica 11 de LPP.}
|
13
|
+
spec.description = %q{Referencias en una Bibliografía}
|
14
|
+
spec.homepage = "https://github.com/alu0100502107/prct11"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
+
# delete this section to allow pushing this gem to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
+
end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
31
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
32
|
+
spec.add_development_dependency "rspec"
|
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 "coveralls"
|
37
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "bibliografia"
|
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
|
data/bin/setup
ADDED
data/lib/bibliografia.rb
ADDED
@@ -0,0 +1,331 @@
|
|
1
|
+
# Módulo Bibliografía
|
2
|
+
module Bibliografia
|
3
|
+
|
4
|
+
# Clase Referencia para gestionar una Bibliografía
|
5
|
+
class Referencia
|
6
|
+
include Comparable
|
7
|
+
|
8
|
+
# Getters + Setters
|
9
|
+
attr_accessor :titulo, :autores, :fechas_publicacion
|
10
|
+
|
11
|
+
# Constructor
|
12
|
+
def initialize(titulo, &bloque)
|
13
|
+
self.titulo = titulo
|
14
|
+
self.autores = []
|
15
|
+
self.fechas_publicacion = []
|
16
|
+
|
17
|
+
instance_eval &bloque if block_given?
|
18
|
+
end
|
19
|
+
|
20
|
+
# Introduce un string con el autor de la referencia
|
21
|
+
def autor(nombre, opciones = {})
|
22
|
+
autor = nombre
|
23
|
+
autores << autor
|
24
|
+
end
|
25
|
+
|
26
|
+
# Introduce un string con la fecha de publicación de la referencia
|
27
|
+
def fecha_publicacion(formato, opciones = {})
|
28
|
+
fecha_publicacion = formato
|
29
|
+
fechas_publicacion << fecha_publicacion
|
30
|
+
end
|
31
|
+
|
32
|
+
# Guerra de las galaxias
|
33
|
+
def <=>(other)
|
34
|
+
if((@autores <=> other.autores) == 0)
|
35
|
+
if((@fechas_publicacion <=> other.fechas_publicacion) == 0)
|
36
|
+
@titulos <=> other.titulos
|
37
|
+
else
|
38
|
+
@fechas_publicacion <=> other.fechas_publicacion
|
39
|
+
end
|
40
|
+
else
|
41
|
+
@autores <=> other.autores
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# Clase Libro hija de Rerefencia
|
47
|
+
class Libro < Referencia
|
48
|
+
# Getters + Setters
|
49
|
+
attr_accessor :num_ediciones, :volumenes, :lugares_publicacion, :editoriales, :num_isbns
|
50
|
+
|
51
|
+
# Constructor
|
52
|
+
def initialize(titulo, &bloque)
|
53
|
+
self.titulo = titulo
|
54
|
+
self.autores = []
|
55
|
+
self.fechas_publicacion = []
|
56
|
+
self.num_ediciones = []
|
57
|
+
self.volumenes = []
|
58
|
+
self.lugares_publicacion = []
|
59
|
+
self.editoriales = []
|
60
|
+
self.num_isbns = []
|
61
|
+
|
62
|
+
instance_eval &bloque if block_given?
|
63
|
+
end
|
64
|
+
|
65
|
+
# Introduce un string con el autor de un libro
|
66
|
+
def autor(nombre, opciones = {})
|
67
|
+
autor = nombre
|
68
|
+
autores << autor
|
69
|
+
end
|
70
|
+
|
71
|
+
# Introduce un string con la fecha de publicación de un libro
|
72
|
+
def fecha_publicacion(fecha, opciones = {})
|
73
|
+
fecha_publicacion = fecha
|
74
|
+
fechas_publicacion << fecha_publicacion
|
75
|
+
end
|
76
|
+
|
77
|
+
# Introduce un string con la edición de un libro
|
78
|
+
def num_edicion(numero, opciones = {})
|
79
|
+
num_edicion = numero
|
80
|
+
num_ediciones << num_edicion
|
81
|
+
end
|
82
|
+
|
83
|
+
# Introduce un string con el volumen de un libro
|
84
|
+
def volumen(numero, opciones = {})
|
85
|
+
volumen = numero
|
86
|
+
volumenes << volumen
|
87
|
+
end
|
88
|
+
|
89
|
+
# Introduce un string con el lugar de publicación de un libro
|
90
|
+
def lugar_publicacion(pais, opciones = {})
|
91
|
+
lugar_publicacion = pais
|
92
|
+
lugares_publicacion << lugar_publicacion
|
93
|
+
end
|
94
|
+
|
95
|
+
# Introduce un string con la editorial de un libro
|
96
|
+
def editorial(nombre, opciones = {})
|
97
|
+
editorial = nombre
|
98
|
+
editoriales << editorial
|
99
|
+
end
|
100
|
+
|
101
|
+
# Introduce un string con el isbn de un libro
|
102
|
+
def num_isbn(numero, opciones = {})
|
103
|
+
num_isbn = numero
|
104
|
+
num_isbns << num_isbn
|
105
|
+
end
|
106
|
+
|
107
|
+
# Para método puts
|
108
|
+
def to_s()
|
109
|
+
salida = "#{titulo},"
|
110
|
+
salida << " #{autores.join(', ')}, "
|
111
|
+
salida << "(#{fechas_publicacion.join(', ')}), "
|
112
|
+
salida << "(#{num_ediciones.join(', ')}), "
|
113
|
+
salida << "(#{volumenes.join(', ')}), "
|
114
|
+
salida << "#{lugares_publicacion.join(', ')}, "
|
115
|
+
salida << "#{editoriales.join(', ')}, "
|
116
|
+
salida << "#{num_isbns.join(', ')} "
|
117
|
+
return salida
|
118
|
+
end
|
119
|
+
end # Libro
|
120
|
+
|
121
|
+
# Clase Articulo_Libro hijo de Rerefencia
|
122
|
+
class Articulo_libro < Referencia
|
123
|
+
# Getters + Setters
|
124
|
+
attr_accessor :num_ediciones, :volumenes, :lugares_publicacion, :editoriales, :num_isbns, :nombres_libro, :num_paginas
|
125
|
+
|
126
|
+
# Constructor
|
127
|
+
def initialize(titulo, &bloque)
|
128
|
+
self.titulo = titulo
|
129
|
+
self.autores = []
|
130
|
+
self.fechas_publicacion = []
|
131
|
+
self.num_ediciones = []
|
132
|
+
self.volumenes = []
|
133
|
+
self.lugares_publicacion = []
|
134
|
+
self.editoriales = []
|
135
|
+
self.num_isbns = []
|
136
|
+
self.nombres_libro = []
|
137
|
+
self.num_paginas = []
|
138
|
+
|
139
|
+
instance_eval &bloque if block_given?
|
140
|
+
end
|
141
|
+
|
142
|
+
# Introduce un string con el autor del artículo de un libro
|
143
|
+
def autor(nombre, opciones = {})
|
144
|
+
autor = nombre
|
145
|
+
autores << autor
|
146
|
+
end
|
147
|
+
|
148
|
+
# Introduce un string con la fecha de publicación del artículo de un libro
|
149
|
+
def fecha_publicacion(ano, opciones = {})
|
150
|
+
fecha_publicacion = ano
|
151
|
+
fechas_publicacion << fecha_publicacion
|
152
|
+
end
|
153
|
+
|
154
|
+
# Introduce un string con la edición del artículo de un libro
|
155
|
+
def num_edicion(numero, opciones = {})
|
156
|
+
num_edicion = numero
|
157
|
+
num_ediciones << num_edicion
|
158
|
+
end
|
159
|
+
|
160
|
+
# Introduce un string con el volumen del artículo de un libro
|
161
|
+
def volumen(numero, opciones = {})
|
162
|
+
volumen = numero
|
163
|
+
volumenes << volumen
|
164
|
+
end
|
165
|
+
|
166
|
+
# Introduce un string con el lugar de publicación del artículo de un libro
|
167
|
+
def lugar_publicacion(pais, opciones = {})
|
168
|
+
lugar_publicacion = pais
|
169
|
+
lugares_publicacion << lugar_publicacion
|
170
|
+
end
|
171
|
+
|
172
|
+
# Introduce un string con la editorial del artículo de un libro
|
173
|
+
def editorial(nombre, opciones = {})
|
174
|
+
editorial = nombre
|
175
|
+
editoriales << editorial
|
176
|
+
end
|
177
|
+
|
178
|
+
# Introduce un string con el isbn del artículo de un libro
|
179
|
+
def num_isbn(numero, opciones = {})
|
180
|
+
num_isbn = numero
|
181
|
+
num_isbns << num_isbn
|
182
|
+
end
|
183
|
+
|
184
|
+
# Introduce un string con el nombre del libro del artículo de un libro
|
185
|
+
def nombre_libro(nombre, opciones = {})
|
186
|
+
nombre_libro = nombre
|
187
|
+
nombres_libro << nombre_libro
|
188
|
+
end
|
189
|
+
|
190
|
+
# Introduce un string con el número de páginas que tiene el artículo de un libro
|
191
|
+
def num_pagina(numero, opciones = {})
|
192
|
+
num_pagina = numero
|
193
|
+
num_paginas << num_pagina
|
194
|
+
end
|
195
|
+
|
196
|
+
# Para método puts
|
197
|
+
def to_s()
|
198
|
+
salida = "#{titulo},"
|
199
|
+
salida << " #{autores.join(', ')}, "
|
200
|
+
salida << "(#{fechas_publicacion.join(', ')}), "
|
201
|
+
salida << "(#{num_ediciones.join(', ')}), "
|
202
|
+
salida << "(#{volumenes.join(', ')}), "
|
203
|
+
salida << "#{lugares_publicacion.join(', ')}, "
|
204
|
+
salida << "#{editoriales.join(', ')}, "
|
205
|
+
salida << "#{num_isbns.join(', ')}, "
|
206
|
+
salida << "#{nombres_libro.join(', ')}, "
|
207
|
+
salida << "#{num_paginas.join(', ')} "
|
208
|
+
return salida
|
209
|
+
end
|
210
|
+
end # Articulo_libro
|
211
|
+
|
212
|
+
# Clase Articulo_periodico hijo de Rerefencia
|
213
|
+
class Articulo_periodico < Referencia
|
214
|
+
# Getters + Setters
|
215
|
+
attr_accessor :lugares_publicacion, :nombres_periodico, :num_paginas
|
216
|
+
|
217
|
+
# Constructor
|
218
|
+
def initialize(titulo, &bloque)
|
219
|
+
self.titulo = titulo
|
220
|
+
self.autores = []
|
221
|
+
self.fechas_publicacion = []
|
222
|
+
self.lugares_publicacion = []
|
223
|
+
self.nombres_periodico = []
|
224
|
+
self.num_paginas = []
|
225
|
+
|
226
|
+
instance_eval &bloque if block_given?
|
227
|
+
end
|
228
|
+
|
229
|
+
# Introduce un string con el autor de un artículo de un periodico
|
230
|
+
def autor(nombre, opciones = {})
|
231
|
+
autor = nombre
|
232
|
+
autores << autor
|
233
|
+
end
|
234
|
+
|
235
|
+
# Introduce un string con la fecha de publicación de un artículo de un periodico
|
236
|
+
def fecha_publicacion(ano, opciones = {})
|
237
|
+
fecha_publicacion = ano
|
238
|
+
fechas_publicacion << fecha_publicacion
|
239
|
+
end
|
240
|
+
|
241
|
+
# Introduce un string con el lugar de publicación de un artículo de un periodico
|
242
|
+
def lugar_publicacion(pais, opciones = {})
|
243
|
+
lugar_publicacion = pais
|
244
|
+
lugares_publicacion << lugar_publicacion
|
245
|
+
end
|
246
|
+
|
247
|
+
# Introduce un string con el nombre del periodico de un artículo de un periodico
|
248
|
+
def nombre_periodico(nombre, opciones = {})
|
249
|
+
nombre_periodico = nombre
|
250
|
+
nombres_periodico << nombre_periodico
|
251
|
+
end
|
252
|
+
|
253
|
+
# Introduce un string con el número de página de un artículo de un periodico
|
254
|
+
def num_pagina(numero, opciones = {})
|
255
|
+
num_pagina = numero
|
256
|
+
num_paginas << num_pagina
|
257
|
+
end
|
258
|
+
|
259
|
+
# Para método puts
|
260
|
+
def to_s()
|
261
|
+
salida = "#{titulo},"
|
262
|
+
salida << " #{autores.join(', ')}, "
|
263
|
+
salida << "(#{fechas_publicacion.join(', ')}), "
|
264
|
+
salida << "#{lugares_publicacion.join(', ')}, "
|
265
|
+
salida << "#{nombres_periodico.join(', ')}, "
|
266
|
+
salida << "#{num_paginas.join(', ')} "
|
267
|
+
return salida
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
271
|
+
# Clase Documento electrónico hijo de Rerefencia
|
272
|
+
class Documento_electronico < Referencia
|
273
|
+
# Getters + Setters
|
274
|
+
attr_accessor :formatos, :editoriales, :idiomas
|
275
|
+
|
276
|
+
# Constructor
|
277
|
+
def initialize(titulo, &bloque)
|
278
|
+
self.titulo = titulo
|
279
|
+
self.autores = []
|
280
|
+
self.fechas_publicacion = []
|
281
|
+
self.formatos = []
|
282
|
+
self.editoriales = []
|
283
|
+
self.idiomas = []
|
284
|
+
|
285
|
+
instance_eval &bloque if block_given?
|
286
|
+
end
|
287
|
+
|
288
|
+
# Introduce un string con el autor de un documento electrónico
|
289
|
+
def autor(nombre, opciones = {})
|
290
|
+
autor = nombre
|
291
|
+
autores << autor
|
292
|
+
end
|
293
|
+
|
294
|
+
# Introduce un string con la fecha de publicación de un documento electrónico
|
295
|
+
def fecha_publicacion(ano, opciones = {})
|
296
|
+
fecha_publicacion = ano
|
297
|
+
fechas_publicacion << fecha_publicacion
|
298
|
+
end
|
299
|
+
|
300
|
+
# Introduce un string con el formato de un documento electrónico
|
301
|
+
def formato(tipo, opciones = {})
|
302
|
+
formato = tipo
|
303
|
+
formatos << formato
|
304
|
+
end
|
305
|
+
|
306
|
+
# Introduce un string con la editorial de un documento electrónico
|
307
|
+
def editorial(nombre, opciones = {})
|
308
|
+
editorial = nombre
|
309
|
+
editoriales << editorial
|
310
|
+
end
|
311
|
+
|
312
|
+
# Introduce un string con el idioma de un documento electrónico
|
313
|
+
def idioma(pais, opciones = {})
|
314
|
+
idioma = pais
|
315
|
+
idiomas << idioma
|
316
|
+
end
|
317
|
+
|
318
|
+
# Para método puts
|
319
|
+
def to_s()
|
320
|
+
salida = "#{titulo},"
|
321
|
+
salida << " #{autores.join(', ')}, "
|
322
|
+
salida << "(#{fechas_publicacion.join(', ')}), "
|
323
|
+
salida << "#{formatos.join(', ')}, "
|
324
|
+
salida << "#{editoriales.join(', ')}, "
|
325
|
+
salida << "#{idiomas.join(', ')} "
|
326
|
+
return salida
|
327
|
+
end
|
328
|
+
end # Clase Documento Electrónico
|
329
|
+
end # Módulo Bibliografia
|
330
|
+
|
331
|
+
|
File without changes
|
@@ -0,0 +1,87 @@
|
|
1
|
+
module Bibliografia
|
2
|
+
|
3
|
+
#Nodo de la lista enlazada
|
4
|
+
Nodo = Struct.new(:referencia, :siguiente, :anterior) do
|
5
|
+
|
6
|
+
#Método para puts
|
7
|
+
def to_s
|
8
|
+
@referencia.to_s
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
# Clase Lista enlazada por ambos lados
|
13
|
+
class Lista_enlazada
|
14
|
+
include Enumerable
|
15
|
+
|
16
|
+
#Getter + Setter
|
17
|
+
attr_reader :principio, :final
|
18
|
+
|
19
|
+
#Constructor
|
20
|
+
def initialize
|
21
|
+
@principio = nil
|
22
|
+
@final = nil
|
23
|
+
end
|
24
|
+
|
25
|
+
#Insertar nodo en la lista por el principio
|
26
|
+
def insertar_lista_principio(referencia)
|
27
|
+
if @principio != nil && @principio.siguiente != nil
|
28
|
+
n = @principio
|
29
|
+
@principio = Nodo.new(referencia, n, nil)
|
30
|
+
n.anterior = @principio
|
31
|
+
elsif @principio != nil
|
32
|
+
n = @principio
|
33
|
+
@principio = Nodo.new(referencia, n, nil)
|
34
|
+
n.anterior = @principio
|
35
|
+
@final = n
|
36
|
+
else
|
37
|
+
@principio = Nodo.new(referencia, nil, nil)
|
38
|
+
@final = @principio
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
#Extraer nodo de la lista por el principio
|
43
|
+
def extraer_lista_principio
|
44
|
+
ref = @principio
|
45
|
+
@principio = ref.siguiente
|
46
|
+
if @principio != nil
|
47
|
+
@principio.anterior = nil
|
48
|
+
else
|
49
|
+
@final = @principio
|
50
|
+
end
|
51
|
+
ref
|
52
|
+
end
|
53
|
+
|
54
|
+
#Insertar nodo en la lista por el final
|
55
|
+
def insertar_lista_final(referencia)
|
56
|
+
if @final != nil
|
57
|
+
@final = Nodo.new(referencia, nil, @final)
|
58
|
+
n = @final.anterior
|
59
|
+
n.siguiente = @final
|
60
|
+
else
|
61
|
+
@principio = Nodo.new(referencia, nil, nil)
|
62
|
+
@final = @principio
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
#Extraer nodo de la lista por el final
|
67
|
+
def extraer_lista_final
|
68
|
+
ref = @final
|
69
|
+
@final = ref.anterior
|
70
|
+
if @final != nil
|
71
|
+
@final.siguiente = nil
|
72
|
+
else
|
73
|
+
@principio = @final
|
74
|
+
end
|
75
|
+
ref
|
76
|
+
end
|
77
|
+
|
78
|
+
# Para hacer la clase enumerable
|
79
|
+
def each
|
80
|
+
nodo = @principio
|
81
|
+
while (nodo != nil)
|
82
|
+
yield nodo.referencia
|
83
|
+
nodo = nodo.siguiente
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
metadata
ADDED
@@ -0,0 +1,160 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: Bibliografia_alu0100502107
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- alu0100502107
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-12-18 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.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
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: '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: 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: Referencias en una Bibliografía
|
112
|
+
email:
|
113
|
+
- alu0100502107@ull.edu.es
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".coveralls.yml"
|
119
|
+
- ".gitignore"
|
120
|
+
- ".travis.yml"
|
121
|
+
- CODE_OF_CONDUCT.md
|
122
|
+
- Gemfile
|
123
|
+
- Guardfile
|
124
|
+
- LICENSE.txt
|
125
|
+
- README.md
|
126
|
+
- Rakefile
|
127
|
+
- bibliografia.gemspec
|
128
|
+
- bin/console
|
129
|
+
- bin/setup
|
130
|
+
- lib/bibliografia.rb
|
131
|
+
- lib/bibliografia/bibliografia.rb
|
132
|
+
- lib/bibliografia/cita.rb
|
133
|
+
- lib/bibliografia/lista_enlazada.rb
|
134
|
+
- lib/bibliografia/version.rb
|
135
|
+
homepage: https://github.com/alu0100502107/prct11
|
136
|
+
licenses:
|
137
|
+
- MIT
|
138
|
+
metadata:
|
139
|
+
allowed_push_host: https://rubygems.org
|
140
|
+
post_install_message:
|
141
|
+
rdoc_options: []
|
142
|
+
require_paths:
|
143
|
+
- lib
|
144
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- - ">="
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '0'
|
149
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - ">="
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
154
|
+
requirements: []
|
155
|
+
rubyforge_project:
|
156
|
+
rubygems_version: 2.4.8
|
157
|
+
signing_key:
|
158
|
+
specification_version: 4
|
159
|
+
summary: Práctica 11 de LPP.
|
160
|
+
test_files: []
|