biblio 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.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +17 -0
- data/.travis.yml +6 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/Guardfile +82 -0
- data/LICENSE.txt +21 -0
- data/README.md +3 -0
- data/Rakefile +23 -0
- data/biblio.gemspec +32 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/index.html +0 -0
- data/lib/biblio.rb +11 -0
- data/lib/biblio/apa.rb +100 -0
- data/lib/biblio/article.rb +68 -0
- data/lib/biblio/biblio.rb +36 -0
- data/lib/biblio/fichero.rb +100 -0
- data/lib/biblio/lista.rb +111 -0
- data/lib/biblio/magazine.rb +75 -0
- data/lib/biblio/version.rb +3 -0
- data/pruebas.html +0 -0
- data/pruebas.txt +21 -0
- metadata +179 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: bfe800aaa8f93f10fe98f791ba2de63767778388
|
|
4
|
+
data.tar.gz: eadc452cda38687e9c6d8d6ee3e0046244f4718c
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 9df87c38e458a8aea999d81d29ad741011e98701ab2502f0fc313c4e7808be267c991bb16a18f39a8601f006ce2a66d218294e55cc08f957b5dedd09cbc6cdb2
|
|
7
|
+
data.tar.gz: f8754ada67e4f500effa308dc6bc4a5b6fda88a02fae7801e875ce3e2904c86631706a363b83e498627d050201f87f3e0ba2aa584bfb975914cbb08b1f9211cf
|
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 alu0100812503
|
|
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
data/Rakefile
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require "bundler/gem_tasks"
|
|
2
|
+
require 'rspec/core/rake_task'
|
|
3
|
+
|
|
4
|
+
RSpec::Core::RakeTask.new
|
|
5
|
+
task :default => :spec
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
desc "Run rspec with format: html"
|
|
9
|
+
task :html do
|
|
10
|
+
sh "rspec -Ilib spec/biblio_spec.rb --format html > pruebas.html"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
desc "Run rspec with --format documentation"
|
|
14
|
+
task :doc do
|
|
15
|
+
sh "rspec -Ilib spec/biblio_spec.rb --format documentation"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
desc "Run rspec with --format documentation --out"
|
|
20
|
+
task :docout do
|
|
21
|
+
sh "rspec -Ilib spec/biblio_spec.rb --format documentation --out pruebas.txt"
|
|
22
|
+
end
|
|
23
|
+
|
data/biblio.gemspec
ADDED
|
@@ -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 'biblio/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "biblio"
|
|
8
|
+
spec.version = Biblio::VERSION
|
|
9
|
+
spec.authors = ["alu0100812503"]
|
|
10
|
+
spec.email = ["alu0100812503@ull.edu.es"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
spec.summary = %q{Clase bibliografia}
|
|
14
|
+
spec.description = %q{Clase que representa una bibliografia de libros.}
|
|
15
|
+
spec.license = "MIT"
|
|
16
|
+
|
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
18
|
+
spec.bindir = "exe"
|
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
20
|
+
spec.require_paths = ["lib"]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
25
|
+
spec.add_development_dependency "rspec", "~> 2.11"
|
|
26
|
+
spec.add_development_dependency "guard"
|
|
27
|
+
spec.add_development_dependency "guard-rspec"
|
|
28
|
+
spec.add_development_dependency "guard-bundler"
|
|
29
|
+
spec.add_development_dependency "coveralls"
|
|
30
|
+
spec.add_development_dependency "rdoc"
|
|
31
|
+
|
|
32
|
+
end
|
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "biblio"
|
|
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/index.html
ADDED
|
File without changes
|
data/lib/biblio.rb
ADDED
data/lib/biblio/apa.rb
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
|
|
2
|
+
class APA
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
attr_accessor :arg , :flag, :list
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def initialize(arg,flag)
|
|
10
|
+
|
|
11
|
+
@arg = arg
|
|
12
|
+
@flag = flag
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def insertar(arg)
|
|
19
|
+
@list = List.new()
|
|
20
|
+
@list.insert_multi(arg)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def to_s
|
|
25
|
+
|
|
26
|
+
if @flag == 1
|
|
27
|
+
|
|
28
|
+
i = 0
|
|
29
|
+
author = ""
|
|
30
|
+
|
|
31
|
+
if (@arg.author.count == 1)
|
|
32
|
+
|
|
33
|
+
author = "#{@arg.author[i]}"
|
|
34
|
+
|
|
35
|
+
else
|
|
36
|
+
while i < @arg.author.count
|
|
37
|
+
|
|
38
|
+
if i != @arg.author.count-1
|
|
39
|
+
author = author + "#{@arg.author[i]} & "
|
|
40
|
+
else
|
|
41
|
+
author= author + "#{@arg.author[i]}"
|
|
42
|
+
end
|
|
43
|
+
i= i + 1
|
|
44
|
+
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
"#{author}. (#{@arg.date}). #{@arg.title} (#{@arg.edition}). #{@arg.editorial}"
|
|
48
|
+
|
|
49
|
+
elsif @flag == 2
|
|
50
|
+
|
|
51
|
+
"#{@arg.author}. (#{@arg.date}). #{@arg.title}. #{@arg.newspaper}, #{@arg.pages}"
|
|
52
|
+
|
|
53
|
+
elsif @flag == 3
|
|
54
|
+
|
|
55
|
+
j = 0
|
|
56
|
+
author2 = ""
|
|
57
|
+
|
|
58
|
+
if (@arg.author.count == 1)
|
|
59
|
+
|
|
60
|
+
author2 = "#{@arg.author[j]}"
|
|
61
|
+
|
|
62
|
+
else
|
|
63
|
+
while j < @arg.author.count
|
|
64
|
+
|
|
65
|
+
if j != @arg.author.count-1
|
|
66
|
+
author2 = author2 + "#{@arg.author[j]} & "
|
|
67
|
+
else
|
|
68
|
+
author2= author2 + "#{@arg.author[j]}"
|
|
69
|
+
end
|
|
70
|
+
j= j + 1
|
|
71
|
+
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
if @arg.url == " " and @arg.editione == " "
|
|
76
|
+
|
|
77
|
+
"#{author2}. (#{@arg.date}). #{@arg.title} [#{@arg.type}]"
|
|
78
|
+
|
|
79
|
+
elsif @arg.url == " "
|
|
80
|
+
|
|
81
|
+
"#{author}. (#{@arg.date}). #{@arg.title} (#{@arg.editione}). [#{@arg.type}]"
|
|
82
|
+
|
|
83
|
+
elsif @arg.editione == " "
|
|
84
|
+
|
|
85
|
+
"#{author}. (#{@arg.date}). #{@arg.title} [#{@arg.type}] Disponible en: #{@arg.url} [#{@arg.date_access}]."
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
else
|
|
89
|
+
"#{author2}. (#{@arg.date}). #{@arg.title} (#{@arg.editione}). [#{@arg.type}] Disponible en: #{@arg.url} [#{@arg.date_access}]."
|
|
90
|
+
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
end
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
class Article < Bibliography
|
|
2
|
+
|
|
3
|
+
attr_accessor :newspaper, :pages, :magazine
|
|
4
|
+
|
|
5
|
+
def initialize(title, &block)
|
|
6
|
+
|
|
7
|
+
self.author = []
|
|
8
|
+
self.title = []
|
|
9
|
+
self.date = []
|
|
10
|
+
self.newspaper = []
|
|
11
|
+
self.pages = []
|
|
12
|
+
self.magazine = []
|
|
13
|
+
|
|
14
|
+
if block_given?
|
|
15
|
+
if block.arity == 1
|
|
16
|
+
yield self
|
|
17
|
+
else
|
|
18
|
+
instance_eval &block
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def autor(text, options = {})
|
|
24
|
+
autor= text
|
|
25
|
+
autor << "#{options[:surname]}" if options[:surname]
|
|
26
|
+
autor << " #{options[:name]}" if options[:name]
|
|
27
|
+
|
|
28
|
+
author << autor
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def fecha(text, options = {})
|
|
32
|
+
fecha = text
|
|
33
|
+
fecha << "(#{options[:amount]})" if options[:amount]
|
|
34
|
+
|
|
35
|
+
date << fecha
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def revista(text, options = {})
|
|
39
|
+
revista = text
|
|
40
|
+
revista << "#{options[:titulo]}" if options[:titulo]
|
|
41
|
+
revista << " #{options[:periodico]}" if options[:periodico]
|
|
42
|
+
revista << " #{options[:paginas]}" if options[:paginas]
|
|
43
|
+
magazine << revista
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def to_s
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
formato = "\nRevista en Formato APA:\n"
|
|
52
|
+
output = formato
|
|
53
|
+
|
|
54
|
+
author.each_with_index do |instruction, index|
|
|
55
|
+
output << "\t#{instruction}"
|
|
56
|
+
end
|
|
57
|
+
date.each_with_index do | date, index |
|
|
58
|
+
output << "\n\t#{(date)}"
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
magazine.each_with_index do | magazine, index |
|
|
62
|
+
output << "\n\t#{magazine}"
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
output
|
|
66
|
+
|
|
67
|
+
end
|
|
68
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
class Bibliography
|
|
2
|
+
|
|
3
|
+
include Comparable
|
|
4
|
+
|
|
5
|
+
attr_accessor :author,:title, :date
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def initialize (autor,title,date,editorial)
|
|
10
|
+
@author = autor
|
|
11
|
+
@title = title
|
|
12
|
+
@date = date
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def <=>(other)
|
|
16
|
+
|
|
17
|
+
if (@author != other.author)
|
|
18
|
+
@author <=> other.author
|
|
19
|
+
elsif(@date != other.date)
|
|
20
|
+
@date <=> other.date
|
|
21
|
+
else
|
|
22
|
+
@title <=> other.title
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def ==(other)
|
|
28
|
+
|
|
29
|
+
@title == other.title
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
end
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
|
|
2
|
+
class Book < Bibliography
|
|
3
|
+
|
|
4
|
+
attr_accessor :author, :title, :date, :book, :isbn10, :edition, :series, :editorial
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def initialize (title, &block)
|
|
9
|
+
self.author = []
|
|
10
|
+
self.title = title
|
|
11
|
+
self.date = []
|
|
12
|
+
self.editorial = []
|
|
13
|
+
self.isbn10 = []
|
|
14
|
+
self.edition = []
|
|
15
|
+
self.series = []
|
|
16
|
+
self.book = []
|
|
17
|
+
|
|
18
|
+
if block_given?
|
|
19
|
+
if block.arity == 1
|
|
20
|
+
yield self
|
|
21
|
+
else
|
|
22
|
+
instance_eval &block
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def autor(text, options = {})
|
|
31
|
+
autor= text
|
|
32
|
+
autor << "#{options[:surname]}" if options[:surname]
|
|
33
|
+
autor << " #{options[:name]}" if options[:name]
|
|
34
|
+
|
|
35
|
+
author << autor
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def fecha(text, options = {})
|
|
39
|
+
fecha = text
|
|
40
|
+
editor << " (#{options[:amount]})" if options[:amount]
|
|
41
|
+
|
|
42
|
+
date << fecha
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def libro(text, options = {})
|
|
46
|
+
libro = text
|
|
47
|
+
libro << "#{options[:titulo]}" if options[:titulo]
|
|
48
|
+
libro << " (#{options[:edicion]})" if options[:edicion]
|
|
49
|
+
libro << " (#{options[:serie]})" if options[:serie]
|
|
50
|
+
book << libro
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def editor(text, options = {})
|
|
55
|
+
editor = text
|
|
56
|
+
editor << " (#{options[:amount]})" if options[:amount]
|
|
57
|
+
|
|
58
|
+
editorial << editor
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def isbn(tipo, options = {})
|
|
62
|
+
isbn = tipo
|
|
63
|
+
isbn << " (#{options[:number]})" if options[:number]
|
|
64
|
+
|
|
65
|
+
isbn10 << isbn
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def to_s
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
formato = "\nLibro en Formato APA:\n"
|
|
74
|
+
output = formato
|
|
75
|
+
|
|
76
|
+
author.each_with_index do |instruction, index|
|
|
77
|
+
output << "\t#{instruction}"
|
|
78
|
+
end
|
|
79
|
+
date.each_with_index do | date, index |
|
|
80
|
+
output << "\n\t#{(date)}"
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
book.each_with_index do | book, index |
|
|
85
|
+
output << "\n\t#{book}"
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
editorial.each_with_index do | editorial, index |
|
|
89
|
+
output << "\n\tLugar de publicacion: #{(editorial)}\n"
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
output
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
data/lib/biblio/lista.rb
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
Node = Struct.new(:value,:next,:prev)
|
|
2
|
+
|
|
3
|
+
class List
|
|
4
|
+
|
|
5
|
+
include Enumerable
|
|
6
|
+
|
|
7
|
+
attr_accessor :head, :tail
|
|
8
|
+
|
|
9
|
+
def initialize()
|
|
10
|
+
@head = nil
|
|
11
|
+
@tail = nil
|
|
12
|
+
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def empty?
|
|
16
|
+
|
|
17
|
+
if @head == nil
|
|
18
|
+
return true
|
|
19
|
+
else
|
|
20
|
+
return false
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def insert_beginning(x)
|
|
25
|
+
|
|
26
|
+
node = Node.new(x,nil,nil)
|
|
27
|
+
|
|
28
|
+
if (@head == nil)
|
|
29
|
+
@head = node
|
|
30
|
+
@tail = node
|
|
31
|
+
else
|
|
32
|
+
|
|
33
|
+
temporal_node = @head
|
|
34
|
+
@head = node
|
|
35
|
+
@head.next = temporal_node
|
|
36
|
+
temporal_node.prev = @head
|
|
37
|
+
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def insert_end(x)
|
|
44
|
+
|
|
45
|
+
node = Node.new(x,nil,nil)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
if (@head == nil)
|
|
49
|
+
@head = node
|
|
50
|
+
@tail = node
|
|
51
|
+
else
|
|
52
|
+
|
|
53
|
+
temporal_node = @tail
|
|
54
|
+
@tail = node
|
|
55
|
+
@tail.prev = temporal_node
|
|
56
|
+
temporal_node.next = @tail
|
|
57
|
+
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def insert_multi(nodes)
|
|
62
|
+
|
|
63
|
+
nodes.each do |nodo|
|
|
64
|
+
insert_beginning(nodo)
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def extract_beginning()
|
|
69
|
+
|
|
70
|
+
if @head == nil
|
|
71
|
+
return nil
|
|
72
|
+
else
|
|
73
|
+
temporal_node = @head
|
|
74
|
+
@head = @head.next
|
|
75
|
+
return temporal_node
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def extract_end()
|
|
80
|
+
|
|
81
|
+
if @tail == nil
|
|
82
|
+
return nil
|
|
83
|
+
|
|
84
|
+
else
|
|
85
|
+
|
|
86
|
+
temporal_node = @tail
|
|
87
|
+
@tail = @tail.prev
|
|
88
|
+
return temporal_node
|
|
89
|
+
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def each
|
|
95
|
+
|
|
96
|
+
if (@head == nil) and (@tail == nil)
|
|
97
|
+
|
|
98
|
+
yield nil
|
|
99
|
+
|
|
100
|
+
elsif (@head == @tail)
|
|
101
|
+
|
|
102
|
+
yield @head.value
|
|
103
|
+
|
|
104
|
+
else
|
|
105
|
+
while (@head != nil)
|
|
106
|
+
yield @head.value
|
|
107
|
+
@head = @head.next
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
class Electronic < Bibliography
|
|
2
|
+
|
|
3
|
+
attr_accessor :url, :editione, :type, :date_access, :electronic
|
|
4
|
+
|
|
5
|
+
def initialize(title, &block)
|
|
6
|
+
|
|
7
|
+
self.author = []
|
|
8
|
+
self.title = title
|
|
9
|
+
self.date = []
|
|
10
|
+
self.url = []
|
|
11
|
+
self.editione = []
|
|
12
|
+
self.type = []
|
|
13
|
+
self.date_access = []
|
|
14
|
+
self.electronic = []
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
if block_given?
|
|
18
|
+
if block.arity == 1
|
|
19
|
+
yield self
|
|
20
|
+
else
|
|
21
|
+
instance_eval &block
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def autor(text, options = {})
|
|
27
|
+
autor= text
|
|
28
|
+
autor << "#{options[:surname]}" if options[:surname]
|
|
29
|
+
autor << " #{options[:name]}" if options[:name]
|
|
30
|
+
|
|
31
|
+
author << autor
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def fecha(text, options = {})
|
|
35
|
+
fecha = text
|
|
36
|
+
fecha << "(#{options[:amount]})" if options[:amount]
|
|
37
|
+
|
|
38
|
+
date << fecha
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def electronico(text, options = {})
|
|
42
|
+
electronico = text
|
|
43
|
+
electronico << "#{options[:titulo]}" if options[:titulo]
|
|
44
|
+
electronico << " (#{options[:edicion]})" if options[:edicion]
|
|
45
|
+
electronico << " [#{options[:medio]}]" if options[:medio]
|
|
46
|
+
electronico << " #{options[:url]}" if options[:url]
|
|
47
|
+
electronico << " [#{options[:fecha_acceso]}]" if options[:fecha_acceso]
|
|
48
|
+
|
|
49
|
+
electronic << electronico
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def to_s
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
formato = "\nDocumento electronico en Formato APA:\n"
|
|
57
|
+
output = formato
|
|
58
|
+
|
|
59
|
+
author.each_with_index do |instruction, index|
|
|
60
|
+
output << "\t#{instruction} "
|
|
61
|
+
end
|
|
62
|
+
date.each_with_index do | date, index |
|
|
63
|
+
output << "#{ (date)}."
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
electronic.each_with_index do | electronic, index |
|
|
67
|
+
output << "\n\t#{electronic}"
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
output
|
|
71
|
+
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
end
|
data/pruebas.html
ADDED
|
File without changes
|
data/pruebas.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
Biblio
|
|
3
|
+
[32m has a version number[0m
|
|
4
|
+
Node
|
|
5
|
+
[32m Node exists[0m
|
|
6
|
+
List
|
|
7
|
+
[32m List exists with its head[0m
|
|
8
|
+
[32m Extracted first node correctly[0m
|
|
9
|
+
[32m Inserted node correctly[0m
|
|
10
|
+
[32m Inserted nodes correctly[0m
|
|
11
|
+
[32m Full list[0m
|
|
12
|
+
Bibliography
|
|
13
|
+
[32m Biblio is empty[0m
|
|
14
|
+
[32m Inserted book correctly[0m
|
|
15
|
+
[32m Biblio is not empty[0m
|
|
16
|
+
[32m Inserted books correctly[0m
|
|
17
|
+
[32m Extracted first book correctly[0m
|
|
18
|
+
[32m Biblio is not empty[0m
|
|
19
|
+
|
|
20
|
+
Finished in 0.00351 seconds
|
|
21
|
+
[32m13 examples, 0 failures[0m
|
metadata
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: biblio
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- alu0100812503
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2015-12-15 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.6'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.6'
|
|
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
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: rdoc
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - ">="
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: '0'
|
|
118
|
+
type: :development
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - ">="
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: '0'
|
|
125
|
+
description: Clase que representa una bibliografia de libros.
|
|
126
|
+
email:
|
|
127
|
+
- alu0100812503@ull.edu.es
|
|
128
|
+
executables: []
|
|
129
|
+
extensions: []
|
|
130
|
+
extra_rdoc_files: []
|
|
131
|
+
files:
|
|
132
|
+
- ".coveralls.yml"
|
|
133
|
+
- ".gitignore"
|
|
134
|
+
- ".travis.yml"
|
|
135
|
+
- CODE_OF_CONDUCT.md
|
|
136
|
+
- Gemfile
|
|
137
|
+
- Guardfile
|
|
138
|
+
- LICENSE.txt
|
|
139
|
+
- README.md
|
|
140
|
+
- Rakefile
|
|
141
|
+
- biblio.gemspec
|
|
142
|
+
- bin/console
|
|
143
|
+
- bin/setup
|
|
144
|
+
- index.html
|
|
145
|
+
- lib/biblio.rb
|
|
146
|
+
- lib/biblio/apa.rb
|
|
147
|
+
- lib/biblio/article.rb
|
|
148
|
+
- lib/biblio/biblio.rb
|
|
149
|
+
- lib/biblio/fichero.rb
|
|
150
|
+
- lib/biblio/lista.rb
|
|
151
|
+
- lib/biblio/magazine.rb
|
|
152
|
+
- lib/biblio/version.rb
|
|
153
|
+
- pruebas.html
|
|
154
|
+
- pruebas.txt
|
|
155
|
+
homepage:
|
|
156
|
+
licenses:
|
|
157
|
+
- MIT
|
|
158
|
+
metadata: {}
|
|
159
|
+
post_install_message:
|
|
160
|
+
rdoc_options: []
|
|
161
|
+
require_paths:
|
|
162
|
+
- lib
|
|
163
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
164
|
+
requirements:
|
|
165
|
+
- - ">="
|
|
166
|
+
- !ruby/object:Gem::Version
|
|
167
|
+
version: '0'
|
|
168
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
|
+
requirements:
|
|
170
|
+
- - ">="
|
|
171
|
+
- !ruby/object:Gem::Version
|
|
172
|
+
version: '0'
|
|
173
|
+
requirements: []
|
|
174
|
+
rubyforge_project:
|
|
175
|
+
rubygems_version: 2.4.6
|
|
176
|
+
signing_key:
|
|
177
|
+
specification_version: 4
|
|
178
|
+
summary: Clase bibliografia
|
|
179
|
+
test_files: []
|