refbiblio 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: 98073573dbd5414cc9ea080a7bc0ecf6d333d7f7
4
+ data.tar.gz: 860ee8c8cdae188a2dc8d3d90550809170653053
5
+ SHA512:
6
+ metadata.gz: 3c91be7230431628378250487d247725b8a532810ab0a58595605b601b96b06e88b661afa97c781c859e6c3b9a59ae81d4e6c48dd1102da5d842210f4824201d
7
+ data.tar.gz: dbd54c59d6a7b3fe937701ba71028f935abd70877822bf698e19d36f7f98af121c69b029ba2d9952d39b5622567c6b6213602e33de057eec77313a72bb6d98e2
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in refbiblio.gemspec
4
+ 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.("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
@@ -0,0 +1,22 @@
1
+ # Refbiblio
2
+
3
+ ## Asignatura:Lenguajes y Paradigmas de la Programación
4
+
5
+ ## Práctica 11: Lenguajes de Dominio Específico (DSL - Domain Specific Languages)
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'refbiblio'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install refbiblio
22
+
@@ -0,0 +1,5 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+ RSpec::Core::RakeTask.new
4
+ task :default => :spec
5
+
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "refbiblio"
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,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,11 @@
1
+ require "refbiblio/version"
2
+ require "refbiblio/biblio"
3
+ require "refbiblio/lista"
4
+ require "refbiblio/referencia"
5
+ require "refbiblio/libro"
6
+ require "refbiblio/art_revista"
7
+ require "refbiblio/art_periodico"
8
+ require "refbiblio/doc_electronico"
9
+ module Refbiblio
10
+ # Your code goes here...
11
+ end
@@ -0,0 +1,19 @@
1
+ class Art_periodico < Referencia
2
+ #attr_reader :nombre_per,:pagina
3
+ =begin
4
+ def initialize(autor,titulo,nombre_per,fecha,pagina)
5
+ super(autor,titulo,fecha)
6
+ @nombre_per=nombre_per
7
+ @pagina=pagina
8
+
9
+ end
10
+ =end
11
+ def initialize(nombre={},&block)
12
+ #super(autor,titulo,tipo_doc,nombre)
13
+ self.nombre=nombre
14
+ self.tipo_doc=[]
15
+ self.autor=[]
16
+ self.titulo=[]
17
+ instance_eval &block
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ class Art_rev < Referencia
2
+ #attr_reader :nombre_rev,:volumen, :num_edicion
3
+ =begin
4
+ def initialize(autor,titulo,nombre_rev,volumen,fecha,edicion)
5
+ super(autor,titulo,fecha)
6
+ @nombre_rev=nombre_rev
7
+ @volumen=volumen
8
+ @num_edicion=edicion
9
+ end
10
+ =end
11
+ def initialize(name,&block)
12
+ #super(autor,titulo,tipo_doc,nombre)
13
+ self.nombre=nombre
14
+ self.tipo_doc=[]
15
+ self.autor=[]
16
+ self.titulo=[]
17
+ instance_eval &block
18
+ end
19
+ end
@@ -0,0 +1,41 @@
1
+ #Clase que representa la bliblioteca
2
+
3
+ class Biblioteca
4
+ attr_reader :autor, :isbn, :titulo, :fecha_publicacion, :serie, :editorial, :num_edicion
5
+ def initialize(autor,isbn,titulo,fecha,editorial,edicion)
6
+
7
+ #variables de instancia
8
+ @autor=autor
9
+ @isbn=isbn
10
+ @titulo=titulo
11
+ @fecha_publicacion=fecha
12
+ @editorial=editorial
13
+ @num_edicion=edicion
14
+ end
15
+
16
+ #metodo para insertar la serie del libro
17
+ def set_serie(serie)
18
+ @serie=serie
19
+
20
+ end
21
+
22
+
23
+ #metodo que muestra la referencia formateada de la biblioteca
24
+
25
+ def formato
26
+ puts "------------------------------------------------------------------------------------"
27
+ @autor.each do |aut|
28
+ print aut+","
29
+ end
30
+ puts "\n"+@titulo
31
+ print @serie
32
+ puts @editorial+" : "+edicion+" "+@fecha_serie
33
+
34
+ #añadi self.isbn porque por algun motivo mostraba dos veces el contenido del array
35
+
36
+ puts self.isbn
37
+ puts "------------------------------------------------------------------------------------"
38
+ end
39
+
40
+
41
+ end
@@ -0,0 +1,17 @@
1
+ class Doc_electronico < Referencia
2
+ #attr_reader:url
3
+ =begin
4
+ def initialize(autor,titulo,fecha,url)
5
+ super(autor,titulo,fecha)
6
+ @url=url
7
+ end
8
+ =end
9
+ def initialize(nombre={},&block)
10
+ #super(autor,titulo,tipo_doc,nombre)
11
+ self.nombre=nombre
12
+ self.tipo_doc=[]
13
+ self.autor=[]
14
+ self.titulo=[]
15
+ instance_eval &block
16
+ end
17
+ end
@@ -0,0 +1,29 @@
1
+ #require "./referencia.rb"
2
+ class Libro < Referencia
3
+
4
+ #attr_reader :isbn,:serie, :editorial, :num_edicion
5
+ =begin
6
+ def initialize(autor,isbn,titulo,fecha,editorial,edicion)
7
+ super(autor,titulo,fecha)
8
+ #variables de instancia
9
+ @isbn=isbn
10
+ @editorial=editorial
11
+ @num_edicion=edicion
12
+
13
+ end
14
+ def set_serie(serie)
15
+ @serie=serie
16
+
17
+ end
18
+ =end
19
+
20
+ #El constructor recibe un bloque y llama a los metodos que se encuentran en Referencia.
21
+ def initialize(nombre={},&block)
22
+ #super(autor,titulo,tipo_doc,nombre)
23
+ self.nombre=nombre
24
+ self.tipo_doc=[]
25
+ self.autor=[]
26
+ self.titulo=[]
27
+ instance_eval &block
28
+ end
29
+ end
@@ -0,0 +1,77 @@
1
+ #clase que representa la lista enlazada
2
+ Node=Struct.new(:value,:next,:before)
3
+ class Lista
4
+ include Enumerable
5
+ attr_reader :cabeza,:cola,:n_elementos
6
+ def initialize()
7
+ @cabeza=Node.new(nil,nil,nil)
8
+ @cola=Node.new(nil,nil,nil)
9
+ @n_elementos=0
10
+
11
+ end
12
+ #MÉTODO EACH PARA USO DEL ENUMERABLE(SE USA EL AUTOR EN ESTE CASO)
13
+ def each()
14
+ aux=@cola
15
+
16
+ while aux.next !=nil do
17
+ yield aux.value.autor
18
+ # aux=@cola.next
19
+ aux=aux.next
20
+ end
21
+ end
22
+ #Método insertar por el comienzo de la lista enlazada
23
+ def inserta(item)
24
+
25
+ item.each do |n|
26
+ nodo=Node.new(nil)
27
+ nodo.value=n
28
+ if @cabeza.value==nil
29
+ @cabeza=nodo
30
+ @cola=nodo
31
+
32
+ else
33
+ a_cabeza=@cola
34
+
35
+ while a_cabeza.next!=nil do
36
+
37
+ a_cabeza=a_cabeza.next
38
+
39
+ end
40
+ a_cabeza.next=nodo
41
+ @cabeza=a_cabeza.next
42
+ @cabeza.before=a_cabeza
43
+ end
44
+ @n_elementos=@n_elementos+1
45
+ end
46
+ end
47
+ #Método para extraer el primer elemento de la lista enlazada.
48
+ def extrae
49
+
50
+ a_aux=@cola
51
+ @cola=@cola.next
52
+ @n_elementos=@n_elementos-1
53
+ a_aux
54
+ end
55
+ #Método que comprueba si la lista está vacía o no
56
+ def empty?
57
+ if(@cabeza.value==nil)
58
+ true
59
+ else
60
+ false
61
+ end
62
+ end
63
+ #Método para mostrar el contenido de la lista desde el principio hasta el final.
64
+ def mostrar
65
+ aux_cabeza=@cabeza
66
+ aux_cola=@cola
67
+
68
+ #print "\n de cola hacia adelante:\n "
69
+ print aux_cola.value
70
+ while aux_cola.next!=nil do
71
+ print "\n ->"
72
+ aux_cola=aux_cola.next
73
+ print aux_cola.value
74
+ end
75
+ print "\n=========================================================\n"
76
+ end
77
+ end
@@ -0,0 +1,80 @@
1
+ class Referencia
2
+ include Comparable
3
+ attr_accessor :tipo_doc,:autor,:titulo,:nombre
4
+ =begin
5
+ attr_reader :autor,:titulo,:fecha
6
+ def initialize(autor,titulo,fecha)
7
+ @autor=autor
8
+ @titulo=titulo
9
+ @fecha=fecha
10
+ end
11
+ def <=>(other)
12
+ t_comparable=self.autor <=> other.autor
13
+ t_comparable
14
+ end
15
+ =end
16
+ #constructor recibiendo un bloque del elemento bibliografico.
17
+ def initialize(nombre,&block)
18
+ self.nombre=nombre
19
+ self.tipo_doc=[]
20
+ self.autor=[]
21
+ self.titulo=[]
22
+ if block_given?
23
+ if block.arity == 1
24
+ yield self
25
+ else
26
+ instance_eval &block
27
+ end
28
+ end
29
+ end
30
+
31
+ def <=>(other)
32
+ t_comparable=self.autor <=> other.autor
33
+ t_comparable
34
+ end
35
+ #metodo to_s para mostrar en forma de texto
36
+ def to_s
37
+ output1 = nombre
38
+ output1 << "\n#{'=' * nombre.size}\n"
39
+ output1 << " Autor:\n"
40
+
41
+ autor.reverse.each_with_index do |t_aut, index|
42
+ output1 << " #{t_aut}\n"
43
+ end
44
+ output1 << " #{self.class.to_s}\n"
45
+ tipo_doc.each_with_index do |t_tipodoc, index|
46
+ output1 << " #{t_tipodoc}\n"
47
+ end
48
+ output1 << " Titulo:"
49
+ titulo.each_with_index do |t_titulo, index|
50
+ output1 << " #{t_titulo.capitalize}\n"
51
+ end
52
+ output1
53
+
54
+ end
55
+
56
+
57
+ #muestra la informacion del autor mediante los hash recibidos.
58
+ def aut(options ={})
59
+ t_autor=""
60
+ t_autor << "\t Apellidos: #{options[:apellido]}" if options[:apellido]
61
+ t_autor << "\t Nombre: #{options[:nombre]}" if options[:nombre]
62
+ autor << t_autor
63
+ end
64
+ #muestra el tipo de documento mediante los hash recibidos
65
+ def tipodoc(options={})
66
+ t_tipodoc=""
67
+ t_tipodoc << "\t Nombre libro: #{options[:nombre]}" if options[:nombre]
68
+ t_tipodoc << "\t Volumen: #{options[:volumen]}" if options[:volumen]
69
+ t_tipodoc << "\t Edicion:#{options[:edicion]}" if options[:edicion]
70
+ tipo_doc<< t_tipodoc
71
+ #end
72
+ end
73
+ #muestra la informacion del titulo mediante los hash recibidos.
74
+ def tit(options={})
75
+ t_titulo=""
76
+ t_titulo << "#{options[:titulo]}" if options[:titulo]
77
+ titulo << t_titulo
78
+ end
79
+
80
+ end
@@ -0,0 +1,3 @@
1
+ module Refbiblio
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,32 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'refbiblio/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "refbiblio"
8
+ spec.version = Refbiblio::VERSION
9
+ spec.authors = ["alu0100505078"]
10
+ spec.email = ["alu0100505078@ull.edu.es"]
11
+
12
+ if spec.respond_to?(:metadata)
13
+ #spec.metadata['allowed_push_host'] = "Set to 'http://mygemserver.com' to prevent pushes to rubygems.org, or delete to allow pushes to any server."
14
+ end
15
+
16
+ spec.summary = %q{""}
17
+ spec.description = %q{""}
18
+ spec.homepage = ""
19
+ spec.license = "MIT"
20
+
21
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ spec.bindir = "exe"
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ["lib"]
25
+
26
+ spec.add_development_dependency "bundler", "~> 1.8"
27
+ spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "rspec","~> 2.11"
29
+ spec.add_development_dependency "guard"
30
+ spec.add_development_dependency "guard-rspec"
31
+ spec.add_development_dependency "guard-bundler"
32
+ end
metadata ADDED
@@ -0,0 +1,145 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: refbiblio
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - alu0100505078
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-12-22 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.8'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.8'
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: '2.11'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.11'
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
+ - alu0100505078@ull.edu.es
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - Gemfile
106
+ - Guardfile
107
+ - README.md
108
+ - Rakefile
109
+ - bin/console
110
+ - bin/setup
111
+ - lib/refbiblio.rb
112
+ - lib/refbiblio/art_periodico.rb
113
+ - lib/refbiblio/art_revista.rb
114
+ - lib/refbiblio/biblio.rb
115
+ - lib/refbiblio/doc_electronico.rb
116
+ - lib/refbiblio/libro.rb
117
+ - lib/refbiblio/lista.rb
118
+ - lib/refbiblio/referencia.rb
119
+ - lib/refbiblio/version.rb
120
+ - refbiblio.gemspec
121
+ homepage: ''
122
+ licenses:
123
+ - MIT
124
+ metadata: {}
125
+ post_install_message:
126
+ rdoc_options: []
127
+ require_paths:
128
+ - lib
129
+ required_ruby_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ required_rubygems_version: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ requirements: []
140
+ rubyforge_project:
141
+ rubygems_version: 2.4.6
142
+ signing_key:
143
+ specification_version: 4
144
+ summary: '""'
145
+ test_files: []