Lista 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.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/.coverall.yml +2 -0
  3. data/.travis.yml +7 -0
  4. data/CODE_OF_CONDUCT.md +13 -0
  5. data/Gemfile +4 -0
  6. data/Gemfile.lock +104 -0
  7. data/Guardfile +82 -0
  8. data/LICENSE.txt +21 -0
  9. data/Lista.gemspec +30 -0
  10. data/README.md +42 -0
  11. data/Rakefile +7 -0
  12. data/bin/console +14 -0
  13. data/bin/setup +7 -0
  14. data/coverage/.last_run.json +5 -0
  15. data/coverage/.resultset.json +330 -0
  16. data/coverage/.resultset.json.lock +0 -0
  17. data/doc/Lista.html +132 -0
  18. data/doc/Listaa.html +117 -0
  19. data/doc/Listaa/Autor.html +424 -0
  20. data/doc/Listaa/Bibliografia.html +1439 -0
  21. data/doc/Listaa/DocumentoE.html +283 -0
  22. data/doc/Listaa/Libro.html +471 -0
  23. data/doc/Listaa/Lista.html +963 -0
  24. data/doc/Listaa/Nodo.html +397 -0
  25. data/doc/Listaa/Revista.html +557 -0
  26. data/doc/_index.html +204 -0
  27. data/doc/class_list.html +58 -0
  28. data/doc/css/common.css +1 -0
  29. data/doc/css/full_list.css +57 -0
  30. data/doc/css/style.css +339 -0
  31. data/doc/file.README.html +133 -0
  32. data/doc/file_list.html +60 -0
  33. data/doc/frames.html +26 -0
  34. data/doc/index.html +133 -0
  35. data/doc/js/app.js +219 -0
  36. data/doc/js/full_list.js +181 -0
  37. data/doc/js/jquery.js +4 -0
  38. data/doc/method_list.html +375 -0
  39. data/doc/top-level-namespace.html +114 -0
  40. data/lib/Lista.rb +9 -0
  41. data/lib/Lista/Autor.rb +16 -0
  42. data/lib/Lista/Bibliografia.rb +92 -0
  43. data/lib/Lista/DocumentoE.rb +15 -0
  44. data/lib/Lista/Libro.rb +24 -0
  45. data/lib/Lista/Lista.rb +113 -0
  46. data/lib/Lista/Revista.rb +34 -0
  47. data/lib/Lista/salida.rb +73 -0
  48. data/lib/Lista/version.rb +4 -0
  49. metadata +190 -0
@@ -0,0 +1,114 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Top Level Namespace
8
+
9
+ &mdash; Documentation by YARD 0.8.7.6
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '';
20
+ framesUrl = "frames.html#!top-level-namespace.html";
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="_index.html">Index</a> &raquo;
35
+
36
+
37
+ <span class="title">Top Level Namespace</span>
38
+
39
+
40
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41
+ </div>
42
+
43
+ <div id="search">
44
+
45
+ <a class="full_list_link" id="class_list_link"
46
+ href="class_list.html">
47
+ Class List
48
+ </a>
49
+
50
+ <a class="full_list_link" id="method_list_link"
51
+ href="method_list.html">
52
+ Method List
53
+ </a>
54
+
55
+ <a class="full_list_link" id="file_list_link"
56
+ href="file_list.html">
57
+ File List
58
+ </a>
59
+
60
+ </div>
61
+ <div class="clear"></div>
62
+ </div>
63
+
64
+ <iframe id="search_frame"></iframe>
65
+
66
+ <div id="content"><h1>Top Level Namespace
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+ </dl>
82
+ <div class="clear"></div>
83
+
84
+ <h2>Defined Under Namespace</h2>
85
+ <p class="children">
86
+
87
+
88
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Listaa.html" title="Listaa (module)">Listaa</a></span>
89
+
90
+
91
+
92
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Lista.html" title="Lista (class)">Lista</a></span>
93
+
94
+
95
+ </p>
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+ </div>
106
+
107
+ <div id="footer">
108
+ Generated on Wed Dec 16 01:08:19 2015 by
109
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
110
+ 0.8.7.6 (ruby-2.2.2).
111
+ </div>
112
+
113
+ </body>
114
+ </html>
data/lib/Lista.rb ADDED
@@ -0,0 +1,9 @@
1
+ module Listaa
2
+ require "Lista/Bibliografia.rb"
3
+ require "Lista/DocumentoE.rb"
4
+ require "Lista/Libro.rb"
5
+ require "Lista/Revista.rb"
6
+ require "Lista/version.rb"
7
+ require "Lista/Lista.rb"
8
+ require "Lista/Autor.rb"
9
+ end
@@ -0,0 +1,16 @@
1
+ module Listaa
2
+ class Autor
3
+ attr_reader :nombre,:apellido
4
+ def initialize(nombre,apellido)
5
+ @nombre = nombre
6
+ @apellido = apellido
7
+ end
8
+ def to_s ()
9
+ f=""
10
+ @apellido.collect { |x| f=f+x.to_s+" "}
11
+ f=f+", "
12
+ @nombre.collect { |x| f=f+x[0]+". "}
13
+ f
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,92 @@
1
+ module Listaa
2
+ class Bibliografia
3
+ include Comparable
4
+ attr_reader :Author, :Title, :Serie, :Editorial, :Edicion
5
+ attr_reader :Fecha_Publication
6
+ def initialize(nombre = "Sin título")
7
+ @Author = []
8
+ @Title = nombre
9
+ @Serie = nil
10
+ @Editorial = "Editorial sin definir"
11
+ @Edicion = 0
12
+ @Fecha_Publication = "01-ENE-1901"
13
+ @Tipo = nil
14
+ end
15
+
16
+ def add_author(name,apellido)
17
+ if(@Author == nil)
18
+ @Author = []
19
+ @Author[0] = Listaa::Autor.new(name,apellido)
20
+ else
21
+ @Author << Listaa::Autor.new(name,apellido)
22
+ end
23
+ end
24
+
25
+ def add_title(name)
26
+ @Title = name
27
+ end
28
+
29
+ def add_serie(name)
30
+ @Serie = name
31
+ end
32
+
33
+ def add_editorial(name)
34
+ @Editorial = name
35
+ end
36
+
37
+ def set_edicion(num)
38
+ @Edicion = num
39
+ end
40
+
41
+ def set_publication(fech)
42
+ @Fecha_Publication = fech
43
+ end
44
+
45
+ def get_formato
46
+ a = @Author.join(", ") +"\n"+@Title.to_s+"\n"+@Serie.to_s+
47
+ "; "+@Edicion.to_s+" edition ("+@Fecha_Publication.to_s+")\n"
48
+ end
49
+
50
+ def get_tipo
51
+ @Tipo
52
+ end
53
+
54
+ def <=> (o)
55
+ if autorTo_s!=o.autorTo_s
56
+ autorTo_s <=> o.autorTo_s
57
+ else
58
+ if(o.Fecha_Publication[7..10] > @Fecha_Publication[7..10])
59
+ -1
60
+ else
61
+ 1
62
+ end
63
+ end
64
+ end
65
+
66
+ def autorTo_s
67
+ f=""
68
+ if(@Author.count>1)
69
+ @Author.collect { |x| f=f+x.to_s+" & "}
70
+ else
71
+ @Author.collect { |x| f=f+x.to_s}
72
+ end
73
+ f
74
+ end
75
+
76
+ def autor(apellido,nombre)
77
+ @Author << Listaa::Autor.new([nombre],[apellido])
78
+ end
79
+
80
+ def editorial(edi)
81
+ @Editorial = edi
82
+ end
83
+
84
+ def fecha(fech)
85
+ @Fecha_Publication = fech
86
+ end
87
+
88
+ def edicion(edi)
89
+ @Edicion = edi
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,15 @@
1
+ require './lib/Lista/Bibliografia.rb'
2
+
3
+ module Listaa
4
+ class DocumentoE < Bibliografia
5
+ def initialize(nombre = "",&block) super(nombre)
6
+ @Tipo = "DocumentoE"
7
+
8
+ instance_eval &block
9
+ end
10
+
11
+ def to_s
12
+ f = autorTo_s+"("+@Fecha_Publication.to_s+"). "+@Title+" ("+@Edicion.to_s+"). "+@Editorial
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,24 @@
1
+ require './lib/Lista/Bibliografia.rb'
2
+ module Listaa
3
+ class Libro < Bibliografia
4
+ attr_reader :ISBN
5
+ def initialize(nombre = "",&block) super(nombre)
6
+ @Tipo = "Libro"
7
+ @ISBN = []
8
+
9
+ instance_eval &block
10
+ end
11
+
12
+ def add_ISBN(fech,num)
13
+ @ISBN << [fech,num]
14
+ end
15
+
16
+ def to_s
17
+ f = autorTo_s+"("+@Fecha_Publication.to_s+"). "+@Title+" ("+@Edicion.to_s+"). "+@Editorial
18
+ end
19
+
20
+ def isbn(fech,num)
21
+ @ISBN << [fech,num]
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,113 @@
1
+ module Listaa
2
+
3
+ Nodo = Struct.new(:value, :next, :prev)
4
+
5
+ class Lista
6
+ include Enumerable
7
+ attr_reader :First, :Sz
8
+ def initialize
9
+ @First = nil
10
+ @Sz = 0
11
+ end
12
+
13
+ def push_back(objeto)
14
+ if(@Sz==0)
15
+ @First = Nodo.new(objeto,nil,nil)
16
+ @Last = @First
17
+ else
18
+ @Last.next = Nodo.new(objeto,nil,@Last)
19
+ @Last = @Last.next
20
+ end
21
+ @Sz = @Sz + 1
22
+ end
23
+
24
+ def at(i)
25
+ @Aux = @First
26
+ if(i<@Sz)
27
+ for j in 1..i do
28
+ @Aux = @Aux.next
29
+ end
30
+ @Aux.value
31
+ else
32
+ nil
33
+ end
34
+ end
35
+
36
+ def takeAt(i)
37
+ @Aux = @First
38
+ if(i<@Sz)
39
+ for j in 1..i-1 do
40
+ @Aux = @Aux.next
41
+ end
42
+ @Aux2 = @Aux.next
43
+ @Aux.next = @Aux2.next
44
+ @Sz = @Sz -1
45
+ @Aux2.value
46
+ else
47
+ nil
48
+ end
49
+ end
50
+
51
+ def takeFirst
52
+ if(@Sz>=1)
53
+ @Aux = @First
54
+ @First = @First.next
55
+ @Sz = @Sz -1
56
+ @Aux.value
57
+ else
58
+ nil
59
+ end
60
+ end
61
+
62
+ def iterarFirst(num)
63
+ if(num<@Sz)
64
+ aux = @First
65
+ for i in 0..num-1 do
66
+ aux = aux.next
67
+ end
68
+ aux.value
69
+ else
70
+ nil
71
+ end
72
+ end
73
+
74
+ def iterarLast(num)
75
+ if(num<@Sz)
76
+ aux = @Last
77
+ for i in 0..num-1 do
78
+ aux = aux.prev
79
+ end
80
+ aux.value
81
+ else
82
+ nil
83
+ end
84
+ end
85
+
86
+ def each
87
+ aux = @First
88
+ while aux!=nil
89
+ yield aux.value
90
+ aux = aux.next
91
+ end
92
+ end
93
+
94
+ def to_s
95
+ a = []
96
+ a = sort { |x,y| x <=> y }
97
+
98
+ f=""
99
+ a.collect{ |x| f=f+x.autorTo_s+"\n"}
100
+ f
101
+ end
102
+
103
+ def to_apa
104
+ a = []
105
+ a = sort { |x,y| x <=> y }
106
+
107
+ f=""
108
+ a.collect{ |x| f=f+x.to_s+"\n"}
109
+ f
110
+ end
111
+ end
112
+
113
+ end
@@ -0,0 +1,34 @@
1
+ require './lib/Lista/Bibliografia.rb'
2
+
3
+ module Listaa
4
+ class Revista < Bibliografia
5
+ attr_accessor :impacto, :ISSN
6
+ def initialize(nombre = "",&block) super(nombre)
7
+ @Tipo = "Revista"
8
+ @impacto = 0
9
+ @ISSN = 00000000
10
+
11
+ instance_eval &block
12
+ end
13
+
14
+ def add_ISSN(num)
15
+ @ISSN = num
16
+ end
17
+
18
+ def titleTo_s
19
+ f = @Title.split
20
+ j = ""
21
+ f.collect{|x| if(x.size>3)
22
+ j=j+x.capitalize+" "
23
+ else
24
+ j=j+x+" "
25
+ end
26
+ }
27
+ j
28
+ end
29
+
30
+ def to_s
31
+ f = autorTo_s+"("+@Fecha_Publication.to_s+"). "+titleTo_s+"("+@Edicion.to_s+"). "+@Editorial
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,73 @@
1
+ require_relative 'Bibliografia.rb'
2
+ require_relative 'Lista.rb'
3
+
4
+ a = Bibliografia.new
5
+ b = Bibliografia.new
6
+ c = Bibliografia.new
7
+ d = Bibliografia.new
8
+ e = Bibliografia.new
9
+
10
+ a.add_author("Dave Thomas")
11
+ a.add_author("Andy Hunt")
12
+ a.add_author("Chad Fowler")
13
+ b.add_author("Scott Chacon")
14
+ c.add_author("David Flanagan")
15
+ c.add_author("Yukihiro Matsumoto")
16
+ d.add_author("David Chelimsky")
17
+ d.add_author("Dave Astels")
18
+ d.add_author("Bryan Helmkamp")
19
+ d.add_author("Dan North")
20
+ d.add_author("Zach Dennis")
21
+ d.add_author("Aslak Hellesoy")
22
+ e.add_author("Richard E. Silverman")
23
+
24
+ a.add_title("Programming Ruby 1.9 & 2.0: The Pragmatic Programmers’ Guide. (The Facets of Ruby)")
25
+ b.add_title("Pro Git 2009th Edition. (Pro)")
26
+ c.add_title("The Ruby Programming Language")
27
+ d.add_title("The RSpec Book: Behaviour Driven Development with RSpec, Cucumber, and Friends ")
28
+ e.add_title("Git Pocket Guide")
29
+
30
+ a.add_editorial("Pragmatic Bookshelf")
31
+ b.add_editorial("Apress")
32
+ c.add_editorial("O’Reilly Media")
33
+ d.add_editorial("Pragmatic Bookshelf")
34
+ e.add_editorial("O’Reilly Media")
35
+
36
+ a.add_serie("(The Facets of Ruby)")
37
+ b.add_serie("(Pro)")
38
+ d.add_serie("(The Facets of Ruby)")
39
+
40
+ a.set_edicion(4)
41
+ b.set_edicion(2009)
42
+ c.set_edicion(1)
43
+ d.set_edicion(1)
44
+ e.set_edicion(1)
45
+
46
+ a.set_publication("July 7, 2013")
47
+ b.set_publication("August 27, 2009")
48
+ c.set_publication("February 4, 2008")
49
+ d.set_publication("December 25, 2010")
50
+ e.set_edicion("August 2, 2013")
51
+
52
+ a.add_ISBN([13,"978-1937785499"])
53
+ a.add_ISBN([10,1937785491])
54
+ b.add_ISBN([13,"978-1430218333"])
55
+ b.add_ISBN([10,1430218339])
56
+ c.add_ISBN([10,"0596516177"])
57
+ c.add_ISBN([13,"978-0596516178"])
58
+ d.add_ISBN([10,1934356379])
59
+ d.add_ISBN([13,"978-1934356371"])
60
+ e.add_ISBN([10,1449325866])
61
+ e.add_ISBN([13,"978-1449325862"])
62
+
63
+ m = [a, b, c, d, e]
64
+ l = Lista.new
65
+
66
+ for i in 0..4 do
67
+ l.push_back(m[i])
68
+ end
69
+
70
+ for i in 0..4 do
71
+ puts l.takeFirst.get_formato
72
+ puts "\n"
73
+ end