nitz 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b6af18e613507677b9e28c7874eb622e3b260677
4
+ data.tar.gz: 432aab105c02175b76d65a031d5beaafd719ed51
5
+ SHA512:
6
+ metadata.gz: 7183707689082d6fda4ebe256d067d8b03cd555983048ce8a6cc5fe3603d723727399099a12acc6e72fcb89946a9e2c043624d7bd700a8a8faa016f15e3554a0
7
+ data.tar.gz: 6eca53390d8611b40a670fabf66ab06fa671a2b72d4e45b1126a1ec6d234744281aed04a49f6bed97cd2c4b0b98936c4cb53f3bfc0745a7b16b11f3eea84a400
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,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
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in nitz.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/README.md ADDED
@@ -0,0 +1,43 @@
1
+ {<img src="https://travis-ci.org/alu0100814651/prct10.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/alu0100814651/prct10]
2
+
3
+ {<img src="https://coveralls.io/repos/alu0100814651/prct10/badge.svg?branch=master&service=github" alt="Coverage Status" />}[https://coveralls.io/github/alu0100814651/prct10?branch=master]
4
+
5
+ # Nitz
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/nitz`. 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 'nitz'
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install nitz
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]/nitz/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
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ require 'rspec/core/rake_task'
4
+ RSpec::Core::RakeTask.new
5
+ task :default => :nitz
6
+
7
+ desc "Ejecutar las espectativas de la clase Biblio"
8
+ task :nitz do
9
+ sh "rspec -I. spec/codigo_spec.rb"
10
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "nitz"
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
data/lib/nitz.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "nitz/version"
2
+
3
+ module Nitz
4
+ # Your code goes here...
5
+ end
data/lib/nitz/apa.rb ADDED
@@ -0,0 +1,51 @@
1
+ require 'nitz/codigo'
2
+ require 'nitz/libreria_lista'
3
+
4
+ class APA
5
+ include Comparable
6
+ attr_reader :bibliog, :nombre
7
+ def initialize (biblio)
8
+ @bibliog = biblio
9
+ end
10
+
11
+ def name
12
+ tam = @bibliog.autor.length
13
+ i = 0
14
+ if(tam == 1)
15
+ mensaje = "#{mensaje}"+"Autor, #{@bibliog.apellido[i][0]}. #{@bibliog.autor[i][0]}."
16
+ else
17
+ for i in 0..tam-2
18
+ mensaje = "#{mensaje}"+"Autor, #{@bibliog.apellido[i][0]}. #{@bibliog.autor[i][0]}. & "
19
+ end
20
+ i=i+1
21
+ mensaje = "#{mensaje}"+"Autor, #{@bibliog.apellido[i][0]}. #{@bibliog.autor[i][0]}."
22
+ end
23
+ end
24
+
25
+ def <=> (other)
26
+ if(@bibliog.apellido == other.bibliog.apellido)
27
+ if(@bibliog.fecha == other.bibliog.fecha)
28
+ @bibliog.titulo <=> other.bibliog.titulo
29
+ else
30
+ @bibliog.fecha <=> other.bibliog.fecha
31
+ end
32
+ else
33
+ @bibliog.apellido <=> other.bibliog.apellido
34
+ end
35
+ end
36
+
37
+ def titulo
38
+ lent = @bibliog.titulo.length
39
+ @bibliog.titulo[0] = @bibliog.titulo[0].capitalize
40
+ for var in 0..lent-1
41
+ if (@bibliog.titulo[var] == " ")
42
+ bibliog.titulo[var+1] = bibliog.titulo[var+1].capitalize
43
+ end
44
+ end
45
+ @bibliog.titulo
46
+ end
47
+
48
+ def to_s
49
+ "Nombre del (los) Autor(es): #{name}; Fecha de publicacion: #{@bibliog.fecha}; Titulo: #{@bibliog.titulo}; Edicion: #{@bibliog.edicion}; Publicacion: #{@bibliog.serie}."
50
+ end
51
+ end
@@ -0,0 +1,122 @@
1
+ class Biblio
2
+ include Comparable
3
+ attr_reader :autor, :apellido, :titulo, :serie, :editorial, :edicion, :fecha, :isbn
4
+
5
+ def initialize(&block)
6
+ if block_given?
7
+ instance_eval &block
8
+ end
9
+ end
10
+
11
+ def <=> (other)
12
+ @edicion <=> other.edicion
13
+ end
14
+
15
+ def obtenautor
16
+ @autor
17
+ end
18
+
19
+ def obtentitulo
20
+ @titulo
21
+ end
22
+
23
+ def obtenserie
24
+ @serie
25
+ end
26
+
27
+ def obteneditorial
28
+ @editorial
29
+ end
30
+
31
+ def obtenedicion
32
+ @edicion
33
+ end
34
+
35
+ def obtenfecha
36
+ @fecha
37
+ end
38
+
39
+ def obtenisbn
40
+ @isbn
41
+ end
42
+
43
+ def to_s
44
+ "Autor: #@autor, Titulo: #@titulo, Serie: #@serie, Editorial: #@editorial, #@edicion Edicion, Fecha de Publicacion: #@fecha y ISBN: #@isbn"
45
+ end
46
+ end
47
+
48
+ class Libro < Biblio
49
+ attr_accessor :isbn
50
+
51
+ def initialize (&block)
52
+ if block_given?
53
+ if block.arity == 1
54
+ yield self
55
+ else
56
+ instance_eval &block
57
+ end
58
+ end
59
+ end
60
+
61
+ def isbn(isbn)
62
+ @isbn = isbn
63
+ end
64
+
65
+ def to_s
66
+ "ISBN: #@isbn"
67
+ end
68
+ end
69
+
70
+ class Revista < Biblio
71
+ attr_accessor :revista, :paginas
72
+
73
+ def initialize (&block)
74
+ if block_given?
75
+ instance_eval &block
76
+ end
77
+ end
78
+
79
+ def revista(name)
80
+ @revista = name
81
+ end
82
+
83
+ def to_s
84
+ "Revista: #@revista"
85
+ end
86
+ end
87
+
88
+ class Periodico < Biblio
89
+ attr_reader :periodico
90
+
91
+ def initialize (&block)
92
+ if block_given?
93
+ instance_eval &block
94
+ end
95
+ end
96
+
97
+ def periodico(name)
98
+ @periodico = name
99
+ end
100
+
101
+ def to_s
102
+ "Periodico: #@periodico"
103
+ end
104
+ end
105
+
106
+ class Electronico < Biblio
107
+ attr_reader :editorial
108
+
109
+ def initialize (&block)
110
+ if block_given?
111
+ instance_eval &block
112
+ end
113
+ end
114
+
115
+ def editorial(name)
116
+ @editorial = name
117
+ end
118
+
119
+ def to_s
120
+ "Electronico: #@editorial"
121
+ end
122
+ end
@@ -0,0 +1,85 @@
1
+ Nodo = Struct.new(:value,:next,:prev)
2
+
3
+ class Lista
4
+ include Enumerable
5
+ attr_reader :start, :finish
6
+ attr_accessor :list, :ordenacion
7
+
8
+
9
+ def initialize()
10
+ @start = nil
11
+ @finish = nil
12
+ end
13
+
14
+ def each
15
+ abcd = @start
16
+ while abcd != nil do
17
+ yield abcd.value
18
+ abcd = abcd.next
19
+ end
20
+ end
21
+
22
+ def vacia
23
+ if (@start == nil)
24
+ return true
25
+ else
26
+ return false
27
+ end
28
+ end
29
+
30
+ def insertar(vall)
31
+ aux = insertarfinish(vall)
32
+ @ordenacion = self.sort
33
+ aux
34
+ end
35
+
36
+ def insertarstart(vall)
37
+ nd = Nodo.new(vall,nil,nil)
38
+ if(vacia == true)
39
+ @start = nd
40
+ @finish = nd
41
+ else
42
+ @start.prev = nd
43
+ end
44
+ return true
45
+ end
46
+
47
+ def insertarfinish(vall)
48
+ nd = Nodo.new(vall,nil,nil)
49
+ if(vacia == true)
50
+ @start = nd
51
+ @finish = nd
52
+ else
53
+ nd.prev = @finish
54
+ @finish.next = nd
55
+ @finish = nd
56
+ end
57
+ return true
58
+ end
59
+
60
+ def extraerstart
61
+ if (vacia == true)
62
+ return false
63
+ else
64
+ vall = @start.value
65
+ @start = @start.next
66
+ return vall
67
+ end
68
+ end
69
+
70
+
71
+ def extraerfinish
72
+ if(vacia == true)
73
+ return false
74
+ else
75
+ vall = @finish.value
76
+ @finish = @finish.prev
77
+ if(@finish == nil)
78
+ @start = nil
79
+ else
80
+ @finish.next = nil
81
+ end
82
+ return vall
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,3 @@
1
+ module Nitz
2
+ VERSION = "0.1.0"
3
+ end
data/nitz.gemspec ADDED
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'nitz/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "nitz"
8
+ spec.version = Nitz::VERSION
9
+ spec.authors = ["alu0100814651"]
10
+ spec.email = ["alu0100814651@ull.edu.es"]
11
+
12
+
13
+ spec.summary = %q{Clase bibliografia}
14
+ spec.description = %q{practica06}
15
+ spec.homepage = "http://www.google.es/"
16
+ spec.license = "MIT"
17
+
18
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ spec.bindir = "exe"
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.7"
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
+ end
metadata ADDED
@@ -0,0 +1,158 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nitz
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - alu0100814651
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-12-21 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: practica06
112
+ email:
113
+ - alu0100814651@ull.edu.es
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".coveralls.yml"
119
+ - ".gitignore"
120
+ - ".travis.yml"
121
+ - Gemfile
122
+ - Guardfile
123
+ - README.md
124
+ - Rakefile
125
+ - bin/console
126
+ - bin/setup
127
+ - lib/nitz.rb
128
+ - lib/nitz/apa.rb
129
+ - lib/nitz/codigo.rb
130
+ - lib/nitz/libreria_lista.rb
131
+ - lib/nitz/version.rb
132
+ - nitz.gemspec
133
+ homepage: http://www.google.es/
134
+ licenses:
135
+ - MIT
136
+ metadata: {}
137
+ post_install_message:
138
+ rdoc_options: []
139
+ require_paths:
140
+ - lib
141
+ required_ruby_version: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ required_rubygems_version: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - ">="
149
+ - !ruby/object:Gem::Version
150
+ version: '0'
151
+ requirements: []
152
+ rubyforge_project:
153
+ rubygems_version: 2.4.6
154
+ signing_key:
155
+ specification_version: 4
156
+ summary: Clase bibliografia
157
+ test_files: []
158
+ has_rdoc: