Bibalu0100826999 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d012a64efb0a45effc2961ce20c0614cf62ae2c8
4
+ data.tar.gz: 84bae172f1086e26fce554e31aba180617de525a
5
+ SHA512:
6
+ metadata.gz: 374767127b618f093d5d0df857c78c7a009263c239bce0e70a8a18f525eb3a69b14675fef39137dd48a802bdc2cf6961121738f6f7eb50411b6778fde82bbdd8
7
+ data.tar.gz: ed75dfc7f07c7ddf0b57dcc2c35584f28e2230d9476c150dc2d0d57a9a7616c113450c2ca636787696ca95d83974ff82aa4d979b768df460baa4e2601ae51241
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *~
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.0
4
+ - 1.9.3
5
+ - jruby-19mode # JRuby in 1.9 mode
6
+ - rbx-19mode
@@ -0,0 +1,34 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'Bib/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "Bibalu0100826999"
8
+ spec.version = Bib::VERSION
9
+ spec.authors = ["alu0100826999"]
10
+ spec.email = ["alu0100826999@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{Practica 11}
17
+ spec.description = %q{Lenguajes y paradigmas de la programación}
18
+ spec.license = "MIT"
19
+
20
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
+ spec.bindir = "exe"
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ["lib"]
24
+
25
+ spec.add_development_dependency "bundler", "~> 1.7"
26
+ spec.add_development_dependency "rake", "~> 10.0"
27
+ spec.add_development_dependency "rspec", "~> 2.11"
28
+
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
+
34
+ end
@@ -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 Bib.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ guard :bundler do
2
+ watch('Gemfile')
3
+ # Uncomment next line if your Gemfile contains the `gemspec' command.
4
+ # watch(/^.+\.gemspec/)
5
+ end
6
+
7
+ # Note: The cmd option is now required due to the increasing number of ways
8
+ # rspec may be run, below are examples of the most common uses.
9
+ # * bundler: 'bundle exec rspec'
10
+ # * bundler binstubs: 'bin/rspec'
11
+ # * spring: 'bin/rsspec' (This will use spring if running and you have
12
+ # installed the spring binstubs per the docs)
13
+ # * zeus: 'zeus rspec' (requires the server to be started separetly)
14
+ # * 'just' rspec: 'rspec'
15
+ guard :rspec, cmd: 'bundle exec rspec' do
16
+ watch(%r{^spec/.+_spec\.rb$})
17
+ watch(%r{^lib/Bib/(.+)\.rb$})
18
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
19
+ watch('spec/spec_helper.rb') { "spec" }
20
+ end
21
+
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 alu0100826999
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.
@@ -0,0 +1,43 @@
1
+ Lenguajes y Paradigmas de Programación Práctica 11
2
+ Andrea Rodríguez Rivarés
3
+
4
+
5
+ # Bib
6
+
7
+ 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/Bib`. To experiment with that code, run `bin/console` for an interactive prompt.
8
+
9
+ TODO: Delete this and the text above, and describe your gem
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem 'Bib'
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install Bib
26
+
27
+ ## Usage
28
+
29
+ TODO: Write usage instructions here
30
+
31
+ ## Development
32
+
33
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
34
+
35
+ 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` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
36
+
37
+ ## Contributing
38
+
39
+ 1. Fork it ( https://github.com/[my-github-username]/Bib/fork )
40
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
41
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
42
+ 4. Push to the branch (`git push origin my-new-feature`)
43
+ 5. Create a new Pull Request
@@ -0,0 +1,4 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+ RSpec::Core::RakeTask.new
4
+ task:default=>:spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "Bib"
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,9 @@
1
+ require "Bib/version.rb"
2
+ require "Bib/Bib.rb"
3
+ require "Bib/Lista.rb"
4
+
5
+ module My
6
+ module Gem
7
+
8
+ end
9
+ end
@@ -0,0 +1,197 @@
1
+ class Biblio
2
+
3
+ include Comparable
4
+
5
+ attr_reader :autor, :titulo
6
+
7
+ def initialize(titulo, &bloque)
8
+ self.autor = []
9
+ self.titulo = titulo
10
+
11
+ if block_given?
12
+ if block.arity == 1
13
+ yield self
14
+ else
15
+ instance_eval &bloque
16
+ end
17
+ end
18
+ end
19
+
20
+ def <=> (other)
21
+ @titulo<=> other.titulo
22
+ end
23
+
24
+ end
25
+
26
+
27
+ class Libro < Biblio
28
+
29
+ attr_reader :autor, :serie, :editorial, :numedicion, :fecha, :isbn
30
+
31
+ def initialize(titulo, &block)
32
+ @autor = []
33
+ @titulo = titulo
34
+ @serie = []
35
+ @editorial = []
36
+ @numedicion = []
37
+ @fecha = []
38
+ @isbn = []
39
+
40
+ if block_given?
41
+ if block.arity == 1
42
+ yield self
43
+ else
44
+ instance_eval &block
45
+ end
46
+ end
47
+
48
+ end
49
+
50
+ def author(text, options = {})
51
+ author = text
52
+ author << "(#{options[:name]})" if options[:name]
53
+ autor << author
54
+ end
55
+
56
+ def edit(text, options = {})
57
+ edit = text
58
+ edit << "(#{options[:numedition]})" if options[:numedition]
59
+ editorial << edit
60
+ end
61
+
62
+ def date(text, options = {})
63
+ date = text
64
+ date << "(#{options[:dates]})" if options[:dates]
65
+ fecha << date
66
+ end
67
+
68
+ def to_s()
69
+ output = titulo
70
+ output << ", #{autor.join(', ')}, #{editorial.join(', ')}, #{fecha.join(', ')}\n\n"
71
+ end
72
+
73
+ end
74
+
75
+ class Revista < Biblio
76
+
77
+ attr_reader :autor, :serie, :editorial, :issn
78
+
79
+ def initialize(titulo, &block)
80
+ @autor = []
81
+ @titulo = titulo
82
+ @serie = []
83
+ @issn = []
84
+ @editorial = []
85
+
86
+ if block_given?
87
+ if block.arity == 1
88
+ yield self
89
+ else
90
+ instance_eval &block
91
+ end
92
+ end
93
+ end
94
+
95
+ def author(text, options = {})
96
+ author = text
97
+ author << "(#{options[:name]})" if options[:name]
98
+ autor << author
99
+ end
100
+
101
+ def edit(text, options = {})
102
+ edit = text
103
+ edit << "(#{options[:numedition]})" if options[:numedition]
104
+ editorial << edit
105
+ end
106
+
107
+ def b_issn(text, options = {})
108
+ b_issn = text
109
+ b_issn << "(#{options[:issn]})" if options[:issn]
110
+ issn << b_issn
111
+ end
112
+
113
+ def to_s()
114
+ output = titulo
115
+ output << ", #{autor.join(', ')}, #{editorial.join(', ')}, #{issn.join(', ')}\n\n"
116
+ end
117
+
118
+ end
119
+
120
+
121
+ class Periodico < Biblio
122
+
123
+ attr_reader :autor, :editor, :edicion
124
+
125
+ def initialize(titulo, &block)
126
+ @autor = []
127
+ @titulo = titulo
128
+ @editor = []
129
+ @edicion = []
130
+
131
+ if block_given?
132
+ if block.arity == 1
133
+ yield self
134
+ else
135
+ instance_eval &block
136
+ end
137
+ end
138
+
139
+ end
140
+
141
+ def edit(text, options = {})
142
+ edit = text
143
+ edit << "(#{options[:numedition]})" if options[:numedition]
144
+ edicion << edit
145
+ end
146
+
147
+ def editor(text, options = {})
148
+ editor = text
149
+ editor << "(#{options[:neditor]})" if options[:neditor]
150
+ autor << editor
151
+ end
152
+
153
+ def to_s()
154
+ output = titulo
155
+ output << ", #{autor.join(', ')}, #{edicion.join(', ')}\n\n"
156
+ end
157
+
158
+ end
159
+
160
+
161
+ class Electronico < Biblio
162
+
163
+ attr_reader :autor, :url
164
+
165
+ def initialize(titulo, &block)
166
+ @titulo = titulo
167
+ @autor = []
168
+ @url = []
169
+
170
+ if block_given?
171
+ if block.arity == 1
172
+ yield self
173
+ else
174
+ instance_eval &block
175
+ end
176
+ end
177
+ end
178
+
179
+ def author(text, options = {})
180
+ author = text
181
+ author << "(#{options[:name]})" if options[:name]
182
+ autor << author
183
+ end
184
+
185
+ def n_url(text, options = {})
186
+ n_url = text
187
+ n_url << "(#{options[:direccion]})" if options[:direccion]
188
+ url << n_url
189
+ end
190
+
191
+ def to_s()
192
+ output = titulo
193
+ output << ", #{autor.join(', ')}, #{url.join(', ')}\n\n"
194
+ output
195
+ end
196
+
197
+ end
@@ -0,0 +1,98 @@
1
+ Nodo = Struct.new(:value, :next)
2
+ Nodo2 = Struct.new(:value, :next, :prev)
3
+
4
+ class Lista
5
+ attr_reader :inicio
6
+
7
+ def initialize()
8
+ @inicio = Nodo.new(nil)
9
+ end
10
+
11
+ def insert(nodo) #push
12
+ if (@inicio != nil)
13
+ nodo.next = @inicio
14
+ @inicio = nodo
15
+ end
16
+ true
17
+ end
18
+
19
+ def extract() #pop
20
+ if (@inicio != nil)
21
+ @aux=Nodo.new(nil)
22
+ aux = @inicio
23
+ @inicio = @inicio.next
24
+ return aux.value
25
+ end
26
+ end
27
+
28
+ end
29
+
30
+ class Listadoble
31
+
32
+ include Enumerable
33
+
34
+ attr_accessor :head, :tail
35
+
36
+ def initialize()
37
+ @tail=nil
38
+ @head=nil
39
+ end
40
+
41
+ def insert_head(nodo)
42
+
43
+ nodo_ = Nodo2.new(nodo,nil,nil)
44
+
45
+ if(@tail==nil || @head==nil)
46
+ @tail = nodo_
47
+ @head = nodo_
48
+ else
49
+ nodo_.next = @head
50
+ @head.prev = nodo_
51
+ @head = nodo_
52
+ end
53
+ true
54
+
55
+ end
56
+
57
+ def extract_tail()
58
+
59
+ nodo = @tail.value
60
+ @tail = @tail.prev
61
+
62
+ if(@tail == nil)
63
+ @head = nil
64
+ else
65
+ @tail.next = nil
66
+ end
67
+ return nodo
68
+
69
+ end
70
+
71
+ def each
72
+ nodo = @head
73
+ while (nodo != nil)
74
+ yield nodo.value
75
+ nodo = nodo.next
76
+ end
77
+ end
78
+
79
+
80
+ def to_s()
81
+
82
+ lista_ref = []
83
+ index= 0
84
+
85
+ while(@inicio != nil)
86
+
87
+ lista_ref1 = @inicio.value.to_s()
88
+ lista_ref[index]= lista_ref1
89
+ @inicio= @inicio.next
90
+ index += 1
91
+
92
+ end
93
+
94
+ lista_ref
95
+
96
+ end
97
+
98
+ end
@@ -0,0 +1,3 @@
1
+ module Bib
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,158 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: Bibalu0100826999
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - alu0100826999
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.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: Lenguajes y paradigmas de la programación
112
+ email:
113
+ - alu0100826999@ull.edu.es
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".gitignore"
119
+ - ".travis.yml"
120
+ - Bib.gemspec
121
+ - CODE_OF_CONDUCT.md
122
+ - Gemfile
123
+ - Guardfile
124
+ - LICENSE.txt
125
+ - README.md
126
+ - Rakefile
127
+ - bin/console
128
+ - bin/setup
129
+ - lib/Bib.rb
130
+ - lib/Bib/Bib.rb
131
+ - lib/Bib/Lista.rb
132
+ - lib/Bib/version.rb
133
+ homepage:
134
+ licenses:
135
+ - MIT
136
+ metadata:
137
+ allowed_push_host: https://rubygems.org
138
+ post_install_message:
139
+ rdoc_options: []
140
+ require_paths:
141
+ - lib
142
+ required_ruby_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ required_rubygems_version: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
152
+ requirements: []
153
+ rubyforge_project:
154
+ rubygems_version: 2.4.6
155
+ signing_key:
156
+ specification_version: 4
157
+ summary: Practica 11
158
+ test_files: []