biblioalu0100815146 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1efcfd24b28d69f5e38ffe856ccb0d5b1f30e49a
4
+ data.tar.gz: 0c9ad7bcf38125478a62ae2ed14a84f85c454834
5
+ SHA512:
6
+ metadata.gz: da3d74533f82556765fb147a4a0577373bdd9f0f5aa30a2e53056f9a6728e1dcac0fbab1aefeaa8e579b9a005a8e2b6a1f9aece3f254b545904dad76c5eff8f9
7
+ data.tar.gz: 9b4b96451595555bd4337aba749df29d23ae5f031f4dc3db9191694b38ed6c973172602952a0a8d8d1fe32dec4f81007ffd1e57d88aa96f106d6e264aece0583
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/.gitignore ADDED
@@ -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/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0-p247
4
+ - 1.9.3
5
+ - jruby-19mode # JRuby in 1.9 mode
6
+ - rbx
7
+
8
+ script: bundle exec rspec spec
9
+
@@ -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, 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
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bibliografia.gemspec
4
+ 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.("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 alu0100815146
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,3 @@
1
+ #Lenguajes y Paradigmnas de la programación
2
+ ## Practica 11
3
+ ###Samuel Ramos Barroso
data/Rakefile ADDED
@@ -0,0 +1,5 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new
5
+ task :default => :spec
@@ -0,0 +1,33 @@
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 = "biblioalu0100815146"
8
+ spec.version = Bibliografia::VERSION
9
+ spec.authors = ["Samuel Ramos Barroso"]
10
+ spec.email = ["alu0100815146@ull.edu.es"]
11
+
12
+ if spec.respond_to?(:metadata)
13
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
14
+ end
15
+
16
+ spec.summary = %q{Clase Biblio}
17
+ spec.description = %q{Clase que representa una Bibliografia}
18
+
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.7"
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
+ spec.add_development_dependency "coveralls"
33
+ 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
@@ -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,175 @@
1
+ class Biblio
2
+
3
+ include Comparable
4
+ attr_accessor :titulo, :autor, :fecha
5
+
6
+ def initialize(titulo, &block)
7
+
8
+ self.titulo = titulo
9
+ self.autor = []
10
+ self.fecha = []
11
+
12
+ if block_given?
13
+ if block.arity == 1
14
+ yield self
15
+ else
16
+ instance_eval &block
17
+ end
18
+ end
19
+ end
20
+
21
+ def date(name, options = {})
22
+ date = name
23
+
24
+ fecha << date
25
+ end
26
+
27
+ def author(name, options = {})
28
+ author = name
29
+ author << " (#{options[:amount]})" if options[:amount]
30
+ autor << author
31
+ end
32
+
33
+ def <=>(other)
34
+
35
+ if(@autor != other.autor)
36
+ @autor <=> other.autor
37
+ elsif(@autor == other.autor)
38
+ @fecha <=> other.fecha
39
+ elsif(@fecha == other.fecha && @autor == other.autor)
40
+ @titulo <=> other.titulo
41
+ end
42
+ end
43
+
44
+
45
+ def to_s()
46
+ @salida = " AUTOR/ES: " + "#{@autor}" + " TITULO: " + "#{@titulo}" + " FECHA: " + "#{@fecha}"
47
+ end
48
+
49
+
50
+ end
51
+
52
+ class Libro < Biblio
53
+
54
+ attr_accessor :edicion, :volumen, :lugar
55
+
56
+ def initialize(titulo,&block)
57
+
58
+ self.titulo = titulo
59
+ self.autor = []
60
+ self.fecha = []
61
+ self.edicion = []
62
+ self.volumen = []
63
+ self.lugar = []
64
+
65
+ if block_given?
66
+ if block.arity == 1
67
+ yield self
68
+ else
69
+ instance_eval &block
70
+ end
71
+ end
72
+ end
73
+
74
+ def date(name, options = {})
75
+ date = name
76
+ fecha << date
77
+ end
78
+
79
+ def author(name, options = {})
80
+ author = name
81
+ author << " (#{options[:amount]})" if options[:amount]
82
+ autor << author
83
+ end
84
+
85
+ def edition(name, options = {})
86
+ edition = name
87
+ edicion << edition
88
+ end
89
+ def volume(name, options = {})
90
+ volume = name
91
+ volumen << volume
92
+ end
93
+ def site(name, options = {})
94
+ site = name
95
+ lugar << site
96
+ end
97
+
98
+ def to_s()
99
+
100
+ output = titulo
101
+ output << " #{autor.join(', ')} "
102
+ output << "(#{fecha.join(', ')}) "
103
+ output << "(#{edicion.join(', ')}) "
104
+ output << "(#{volumen.join(', ')}) "
105
+ output << "#{lugar.join(', ')} "
106
+
107
+ output
108
+ end
109
+
110
+
111
+ end
112
+
113
+
114
+
115
+
116
+ class Articulo < Biblio
117
+
118
+ attr_accessor :editor, :paginas, :obra
119
+ def initialize(titulo,&block)
120
+
121
+ self.titulo = titulo
122
+ self.autor = []
123
+ self.fecha = []
124
+ self.editor = []
125
+ self.paginas = []
126
+ self.obra = []
127
+
128
+ if block_given?
129
+ if block.arity == 1
130
+ yield self
131
+ else
132
+ instance_eval &block
133
+ end
134
+ end
135
+
136
+ end
137
+
138
+ def date(name, options = {})
139
+ date = name
140
+ fecha << date
141
+ end
142
+
143
+ def author(name, options = {})
144
+ author = name
145
+ author << " (#{options[:amount]})" if options[:amount]
146
+ autor << author
147
+ end
148
+
149
+ def edit(name, options = {})
150
+ edit = name
151
+ editor << edit
152
+ end
153
+ def pag(name, options = {})
154
+ pag = name
155
+ paginas << pag
156
+ end
157
+ def obr(name, options = {})
158
+ obr = name
159
+ obra << obr
160
+ end
161
+
162
+ def to_s()
163
+
164
+ output = titulo
165
+ output << " #{autor.join(', ')} "
166
+ output << "(#{fecha.join(', ')}) "
167
+ output << "(#{editor.join(', ')}) "
168
+ output << "(#{paginas.join(', ')}) "
169
+ output << "#{obra.join(', ')} "
170
+
171
+ output
172
+ end
173
+
174
+ end
175
+
@@ -0,0 +1,123 @@
1
+
2
+ Node= Struct.new(:value, :next, :prev)
3
+
4
+ class List
5
+
6
+ include Enumerable
7
+ attr_accessor :inicio, :final
8
+
9
+ def initialize()
10
+
11
+ @inicio = nil
12
+ @final = nil
13
+
14
+ end
15
+
16
+ def extraer_inicio()
17
+
18
+ if (@inicio == nil)
19
+
20
+ return nil
21
+ else
22
+ aux = @inicio
23
+ @inicio = @inicio.next
24
+ return aux
25
+ end
26
+ end
27
+
28
+ def insert_inicio(x)
29
+
30
+ nodo = Node.new(x,nil,nil)
31
+ if(@inicio == nil)
32
+ @inicio = nodo
33
+ @final = nodo
34
+ else
35
+ aux = @inicio
36
+ @inicio = nodo
37
+ @inicio.next = aux
38
+ aux.prev = @inicio
39
+ end
40
+ end
41
+ def extraer_final()
42
+
43
+ if (@final == nil)
44
+ return nil
45
+ else
46
+ aux= @final
47
+ @final= final.prev
48
+ return aux
49
+ end
50
+ end
51
+
52
+ def insert_end(x)
53
+
54
+ nodo = Node.new(x,nil,nil)
55
+ if(@final == nil)
56
+ @final = nodo
57
+ @inicio = nodo
58
+ else
59
+ aux = @final
60
+ @final = nodo
61
+ @final.prev = aux
62
+ aux.next = @final
63
+
64
+ end
65
+ end
66
+
67
+
68
+ def insert_multiple(nodos)
69
+
70
+ nodos.each do |element|
71
+ insert_inicio(element)
72
+ end
73
+
74
+ end
75
+
76
+ def vacio()
77
+
78
+ if(@inicio == nil)
79
+
80
+ return true
81
+
82
+ else
83
+
84
+ return false
85
+
86
+ end
87
+
88
+ end
89
+
90
+ def each
91
+
92
+ if (@inicio == nil and @final == nil)
93
+
94
+ yield nil
95
+
96
+ elsif (@inicio == @final)
97
+
98
+ yield @inicio.value
99
+
100
+ else
101
+
102
+ while(@inicio != nil)
103
+
104
+ yield @inicio.value
105
+ @inicio = @inicio.next
106
+
107
+ end
108
+ end
109
+ end
110
+
111
+ def to_s
112
+
113
+ output = []
114
+ i=0;
115
+ while(@inicio != nil)
116
+ output1 = @inicio.value.to_s
117
+ output[i] = output1
118
+ @inicio = @inicio.next
119
+ i = i+1
120
+ end
121
+ output
122
+ end
123
+ end
@@ -0,0 +1,3 @@
1
+ module Bibliografia
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,6 @@
1
+ require "biblioalu0100815146/version"
2
+ require "biblioalu0100815146/biblio"
3
+ require "biblioalu0100815146/lista"
4
+ module Bibliografia
5
+ # Your code goes here...
6
+ end
data/token} ADDED
File without changes
metadata ADDED
@@ -0,0 +1,160 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: biblioalu0100815146
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Samuel Ramos Barroso
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-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.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
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
+ - !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: Clase que representa una Bibliografia
112
+ email:
113
+ - alu0100815146@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/biblioalu0100815146/biblio.rb
131
+ - lib/biblioalu0100815146/lista.rb
132
+ - lib/biblioalu0100815146/version.rb
133
+ - lib/bibliografia.rb
134
+ - token}
135
+ homepage:
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.6
157
+ signing_key:
158
+ specification_version: 4
159
+ summary: Clase Biblio
160
+ test_files: []