largeCsvProcessing 0.1.0 → 2.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ca4889d4f2f7d7a5c65f826c1ed942e995511c12cdc524b1486459b655606347
4
- data.tar.gz: c3f2be09986e0545b554dd019890a00a77057709e89c6776122b4d4a4cc6276b
3
+ metadata.gz: 671b2e93fa94be4ce74653a45305197c664a94b21214cfd5dea94b0597cb7f05
4
+ data.tar.gz: 6bc4b384f365b79b8431cbb395821f2765c0487b2d2e251c032b2706da5e955a
5
5
  SHA512:
6
- metadata.gz: 539dc1e0140800e32eb8ca71e8089e126de2fbdfde756480ba6fecc513b44cf0d2c0186d9be14ffb9a32163708b11d7af7adca22a61e96224e0d0f19f89011c6
7
- data.tar.gz: dbfbb73b0a07015f865b03e21efa52689c4d1021398e8581d34c3fe7dff17c38e710b0701b46e690fac0bfdebb981558205cf8f11178b52833fa5401468b0c22
6
+ metadata.gz: a0b8ab28216f9fe287206ac382e1c834091fb4c41982aedb5364c77d00fcb55ab0e2c47223278cf19b37633be634ca3bec1e8e8dd3b54cadbd93f4295beba5da
7
+ data.tar.gz: f3e387d3e000f71a0eeb225b9ac330c5fe83314da138f81fa198eb8ce973c10ce8cdd19512063881c2c462fa5f75adfc8b6643a4d442fd9e9aba68142ce6fc44
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # gem "rails"
6
+ gem 'rspec', '~> 3.0'
data/Gemfile.lock ADDED
@@ -0,0 +1,26 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ diff-lcs (1.5.0)
5
+ rspec (3.11.0)
6
+ rspec-core (~> 3.11.0)
7
+ rspec-expectations (~> 3.11.0)
8
+ rspec-mocks (~> 3.11.0)
9
+ rspec-core (3.11.0)
10
+ rspec-support (~> 3.11.0)
11
+ rspec-expectations (3.11.0)
12
+ diff-lcs (>= 1.2.0, < 2.0)
13
+ rspec-support (~> 3.11.0)
14
+ rspec-mocks (3.11.1)
15
+ diff-lcs (>= 1.2.0, < 2.0)
16
+ rspec-support (~> 3.11.0)
17
+ rspec-support (3.11.0)
18
+
19
+ PLATFORMS
20
+ x86_64-linux
21
+
22
+ DEPENDENCIES
23
+ rspec (~> 3.0)
24
+
25
+ BUNDLED WITH
26
+ 2.3.7
data/README.md CHANGED
@@ -1,13 +1,55 @@
1
- # -----------TAREA 1 LARGE CSV PROCESSING-----------!
1
+ # -----------( SPANISH ) TASK 1 - LARGE CSV PROCESSING-----------!
2
+
3
+ Write the script csv_generator.rb that takes an integer as a parameter and generates an extract in millions of rows. For example, if it is executed with parameter 1, then the extract will have 1 million rows + 1 for the header.
2
4
 
3
- Escribir el script csv_generator.rb que tome como parámetro un número entero y genere un extracto en millones de filas. Por ejemplo si se ejecuta con parámetro 1 entonces el extracto tendrá 1 millones de filas + 1 por la cabecera.
5
+ # Content AND OTHER DETAILS:
4
6
 
5
- # FUNCIONAMIENTO Y OTROS DETALLES:
7
+ 1. csv_generator.rb: is the main program in which a 'case' is used to access a 'normal' mode, 'benchmark/memory' mode and stok_stats. The first two create an object based on the class located in ./generatr/generator.rb, with the difference that the benchmark mode is more limited but returns other extra parameters.
6
8
 
7
- csv_generator.rb es un programa que consta de dos partes, cada parte está en las carpetas lector y extractor respectivamente los cuales describo a continuación:
9
+ generator.rb: contains the Generator class, its variables are an input digit, the header and its 4 books. It also contains a "newFile" method which multiplies the input by a million and creates a file.csv by writing the header and so many million books to it.
8
10
 
9
- 1) A falta de un archivo lector para extraer contenido como pide esta tarea, creé un programa en la carpeta lector, el cual ingresando un número crea un archivo csv de registros con la cantidad ingresada multiplicado por 1_000_000. (se puede decir que este archivo lector.csv es una pseudotabla de la base de datos)
11
+ 2. file.csv: In the first line is the header and in the following there will be as many millions of books as the input data says.
10
12
 
11
- 2) Ya con este archivo... Se ejecuta el programa extractor, el cual pide un segundo numero que se multiplicará por 1_000_000 y devolverá ese numero de filas extraidas del primer archivo. (este archivo extracto.csv extrae las filas solicitadas de la pseudotabla anteriormente creada)
13
+ 3.
12
14
 
13
- # ESTE EJERCICIO SE CONVIRTIÓ EN GEMA!
15
+ NOTE1: To facilitate the evaluation, the file 'autoEvaluacion.txt' was created
16
+
17
+ Four.
18
+
19
+ NOTE2: To run an rspec test run the file from terminal: bin/rspec
20
+
21
+ # THIS EXERCISE BECAME A GEM!
22
+
23
+ With the following command the gem was built:
24
+
25
+ gem build largeCsvProcessing.gemspec
26
+
27
+ The following command is used to install the gem locally:
28
+
29
+ gem install ./largeCsvProcessing-2.0.0.gem
30
+
31
+ The following command is used to install the gem remotely:
32
+
33
+ gem install largeCsvProcessing
34
+
35
+ The following command is used to uninstall the gem:
36
+
37
+ gem uninstall largeCsvProcessing
38
+
39
+ The following command is used to publish the gem to rubygems:
40
+
41
+ gem push largeCsvProcessing-2.0.0.gem
42
+
43
+ To run the installed gem it can be accessed by irb:
44
+
45
+ require 'csv_generator'
46
+
47
+ # BIBLIOGRAPHY
48
+
49
+ https://rubygems.org/?locale=es
50
+
51
+ https://blog.desafiolatam.com/create-a-gema-ruby/
52
+
53
+ https://medium.com/swlh/benchmarking-in-ruby-86a6c28c1e97
54
+
55
+ https://rspec.info/
@@ -0,0 +1,80 @@
1
+ 1.- LARGE CSV PROCESSING
2
+
3
+ 1. ¿Puede generar un archivo de 1 GB? 0.5 pts
4
+
5
+ En modo normal si! mi ram es de 8Gb y eh creado archivos incluso de hasta 32Gb. En modo benchmark el numero maximó para ingreso de datos es 11 y por alguna razón la ram se satura.
6
+
7
+ 2. ¿Posee un archivo del tamaño del doble de la memoria? 0.5 pts
8
+
9
+ Sí! mi ram es de 8Gb y eh creado archivos incluso de hasta 32Gb osea el cuadruple de la memoria
10
+
11
+ 3. ¿Finaliza con el archivo de 1 GB? 1 pts
12
+
13
+ Sí!
14
+
15
+ 4. ¿Finaliza con el archivo de tamaño del doble de la memoria? ¿Cómo se comporta la memoria durante la ejecución? 2 pts
16
+
17
+ En modo normal si! mi ram es de 8Gb y eh creado archivos incluso de hasta 32Gb. En modo benchmark el numero maximó para ingreso de datos es 11 y por alguna razón la ram se satura.
18
+
19
+ 5. ¿Qué refacciones realizó sobre la solución original? 1 pts
20
+
21
+ * book_in_stock.rf ahora es obsoleto
22
+
23
+ * csv_reader.rb :
24
+
25
+ La clase CsvReader se modificó por completo para que no guarde en un array las filas del archivo.csv.
26
+
27
+ Él método read_in_csv_data ahora recorre las filas del archivo csv, lee el dato precio, lo transforma a float y lo suma a la variable 'sum'.
28
+
29
+ Él método total_value_in_stock solo retorna la variable 'sum'.
30
+
31
+ 6. ¿Realizó un benchmark de la memoria en ruby? 1 pts
32
+
33
+ Sí, pero de ello tengo más preguntas que respuestas :'(
34
+
35
+
36
+ 2.- GEMS
37
+
38
+ 1. ¿La gema está publicada? 0.5 pts
39
+
40
+ sí, en:
41
+
42
+ https://rubygems.org/gems/largeCsvProcessing
43
+
44
+ https://github.com/duemarfra/largeCsvProcessing/
45
+
46
+ 2. ¿Se puede instalar la gema? 1 pts
47
+
48
+ sí, con el comando: gem install largeCsvProcessing
49
+
50
+ 3. ¿Se puede utilizar la gema? Osea la gema cumple con una funcionalidad. 2~4pts.
51
+
52
+ Sí, esta gema cumple con los requisitos del enunciado.
53
+
54
+ 4. ¿Está documentado el uso de la gema? 1 pts
55
+
56
+ sí! en: en README.md y readmeEs.txt
57
+
58
+ 5. ¿Se puede desinstalar la gema? 0.5 pts
59
+
60
+ sí, con el comando: gem uninstall largeCsvProcessing
61
+
62
+ 6. ¿Realizaron pruebas (testing) de la gema? (Opcional) 1 pts
63
+
64
+ sí, por medio de un modulo bundler se instalo Rspec. Y se comprobó que corra la clase 'Generator' del archivo generator.rb
65
+
66
+
67
+ PREGUNTAS
68
+ * ¿Podría ser útil hospedar nuestro código en algún servidor?
69
+
70
+ Sí para tener un mejor control de versiones, para que otros clientes puedan acceder al codigo y lo modifiquen mediante un fork o por descargas y sea más funcional a cada persona. Para disponer nosotros mismos del código en cualquier lugar que estemos.
71
+
72
+ * ¿Vale la pena tener una base de datos?
73
+
74
+ En el caso de estos programas tal ves no tanto, pero si llegasemos a tener datos "sensibles" definitivamente sería lo mejor el contar con una base de datos.
75
+
76
+ ¿Y si quiero que ahora la notificación sea una hora antes?
77
+ ----------------
78
+ Podría crear un evento en Google Calendar y sincronizarlo desde ahí?
79
+ ----------------
80
+ Ejerciten ese cerebruto y piensen alternativas para llegar al objetivo.
data/bin/rspec ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rspec' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rspec-core", "rspec")
data/lib/csv_generator.rb CHANGED
@@ -1,12 +1,41 @@
1
- require_relative './lector/lector'
1
+ require_relative './generatr/generator.rb'
2
+ require 'benchmark/memory'
2
3
 
3
- lecturaSemanal = Lector.new
4
- lecturaSemanal.nMillones = gets.chomp
5
- lecturaSemanal.nuevaLectura
4
+ puts '******** welcome to your large csv processor ********'
5
+ puts "options:\n0 for start benchmark mode\n1 for start normal mode program\n2 for run stock_stats (require run step 1)"
6
6
 
7
+ lecturaSemanal = Generator.new
8
+ option = gets.chomp
7
9
 
8
- require_relative './extractor/extractor'
10
+ case option
9
11
 
10
- extracto = Extractor.new
11
- extracto.nMillones = gets.chomp
12
- extracto.nuevoExtracto
12
+ when '0'
13
+
14
+ puts 'How many millions of books do you want??'
15
+ puts "Alert!! Only give me the number (0,11], otherwise the memory goes BOOM and becomes a killer!!"
16
+
17
+ lecturaSemanal.millions = gets.chomp
18
+
19
+ Benchmark.memory do |x|
20
+
21
+ x.report('creación del archivo'){lecturaSemanal.newFile}
22
+
23
+ end
24
+
25
+ when '1'
26
+
27
+ puts 'How many millions of books do you want?? (give me the number)'
28
+ puts 'Example: 27 make a file.csv of 1GB, 432 make a file.csv of 16GB'
29
+
30
+ lecturaSemanal.millions = gets.chomp
31
+ lecturaSemanal.newFile
32
+
33
+ when '2'
34
+
35
+ require_relative 'stockStats/stock_stats'
36
+
37
+ else
38
+
39
+ puts 'invalid option'
40
+
41
+ end
data/readmeEs.txt ADDED
@@ -0,0 +1,55 @@
1
+ # -----------( ESPAÑOL ) TAREA 1 - LARGE CSV PROCESSING-----------!
2
+
3
+ Escribir el script csv_generator.rb que tome como parámetro un número entero y genere un extracto en millones de filas. Por ejemplo si se ejecuta con parámetro 1 entonces el extracto tendrá 1 millones de filas + 1 por la cabecera.
4
+
5
+ # Contenido Y OTROS DETALLES:
6
+
7
+ 1. csv_generator.rb: es el programa principal en el cual mediante un 'case' se accede a un modo 'normal', modo 'benchmark/memory' y al stok_stats. Los dós primeros crean un objeto en base la clase ubicada en ./generatr/generator.rb, con la diferencia que el modo benchmark es más limitado pero retorna otros parametros extras.
8
+
9
+ generator.rb: contiene la clase Generator, sus variables son un digito de entrada, la cabecera y sus 4 libros. Tambien contiene un método "newFile" el cual multiplica el dato de entrada por un millon y crea un archivo file.csv escribiendo en él, la cabecera y tantos millones de libros.
10
+
11
+ 2. file.csv: En la primera linea se encuantra la cabecera y en las siguientes habrá tantos millones de libros como el dato de entrada lo diga.
12
+
13
+ 3.
14
+
15
+ NOTA1: Para facilitar la evaluacion se creó el archivo 'autoEvaluacion.txt'
16
+
17
+ 4.
18
+
19
+ NOTA2: Para ejecutar un test rspec ejecutar desde terminal el archiv: bin/rspec
20
+
21
+ # ESTE EJERCICIO SE CONVIRTIÓ EN GEMA!
22
+
23
+ Con el siguiente comando se construyó la gema:
24
+
25
+ gem build largeCsvProcessing.gemspec
26
+
27
+ El siguiente comando sirve para instalar la gema de manera local:
28
+
29
+ gem install ./largeCsvProcessing-2.0.0.gem
30
+
31
+ El siguiente comando sirve para instalar la gema de manera remota:
32
+
33
+ gem install largeCsvProcessing
34
+
35
+ El siguiente comando sirve para desinstalar la gema:
36
+
37
+ gem uninstall largeCsvProcessing
38
+
39
+ El siguiente comando sirve para publicar la gema en rubygems:
40
+
41
+ gem push largeCsvProcessing-2.0.0.gem
42
+
43
+ Para ejecutar la gema instalada se puede acceder por irb:
44
+
45
+ require 'csv_generator'
46
+
47
+ # BIBLIOGRAFÍA
48
+
49
+ https://rubygems.org/?locale=es
50
+
51
+ https://blog.desafiolatam.com/crear-una-gema-ruby/
52
+
53
+ https://medium.com/swlh/benchmarking-in-ruby-86a6c28c1e97
54
+
55
+ https://rspec.info/
@@ -0,0 +1,12 @@
1
+ require_relative '../lib/generatr/generator'
2
+
3
+ describe "Generator" do
4
+
5
+ it 'class newFile runs?' do
6
+
7
+ algg = Generator.new
8
+ algg.millions = gets.chomp
9
+ expect(algg.newFile).to eq(true)
10
+
11
+ end
12
+ end
@@ -0,0 +1,98 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # See https://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
16
+ RSpec.configure do |config|
17
+ # rspec-expectations config goes here. You can use an alternate
18
+ # assertion/expectation library such as wrong or the stdlib/minitest
19
+ # assertions if you prefer.
20
+ config.expect_with :rspec do |expectations|
21
+ # This option will default to `true` in RSpec 4. It makes the `description`
22
+ # and `failure_message` of custom matchers include text for helper methods
23
+ # defined using `chain`, e.g.:
24
+ # be_bigger_than(2).and_smaller_than(4).description
25
+ # # => "be bigger than 2 and smaller than 4"
26
+ # ...rather than:
27
+ # # => "be bigger than 2"
28
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
29
+ end
30
+
31
+ # rspec-mocks config goes here. You can use an alternate test double
32
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
33
+ config.mock_with :rspec do |mocks|
34
+ # Prevents you from mocking or stubbing a method that does not exist on
35
+ # a real object. This is generally recommended, and will default to
36
+ # `true` in RSpec 4.
37
+ mocks.verify_partial_doubles = true
38
+ end
39
+
40
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
41
+ # have no way to turn it off -- the option exists only for backwards
42
+ # compatibility in RSpec 3). It causes shared context metadata to be
43
+ # inherited by the metadata hash of host groups and examples, rather than
44
+ # triggering implicit auto-inclusion in groups with matching metadata.
45
+ config.shared_context_metadata_behavior = :apply_to_host_groups
46
+
47
+ # The settings below are suggested to provide a good initial experience
48
+ # with RSpec, but feel free to customize to your heart's content.
49
+ =begin
50
+ # This allows you to limit a spec run to individual examples or groups
51
+ # you care about by tagging them with `:focus` metadata. When nothing
52
+ # is tagged with `:focus`, all examples get run. RSpec also provides
53
+ # aliases for `it`, `describe`, and `context` that include `:focus`
54
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
55
+ config.filter_run_when_matching :focus
56
+
57
+ # Allows RSpec to persist some state between runs in order to support
58
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
59
+ # you configure your source control system to ignore this file.
60
+ config.example_status_persistence_file_path = "spec/examples.txt"
61
+
62
+ # Limits the available syntax to the non-monkey patched syntax that is
63
+ # recommended. For more details, see:
64
+ # https://relishapp.com/rspec/rspec-core/docs/configuration/zero-monkey-patching-mode
65
+ config.disable_monkey_patching!
66
+
67
+ # This setting enables warnings. It's recommended, but in some cases may
68
+ # be too noisy due to issues in dependencies.
69
+ config.warnings = true
70
+
71
+ # Many RSpec users commonly either run the entire suite or an individual
72
+ # file, and it's useful to allow more verbose output when running an
73
+ # individual spec file.
74
+ if config.files_to_run.one?
75
+ # Use the documentation formatter for detailed output,
76
+ # unless a formatter has already been configured
77
+ # (e.g. via a command-line flag).
78
+ config.default_formatter = "doc"
79
+ end
80
+
81
+ # Print the 10 slowest examples and example groups at the
82
+ # end of the spec run, to help surface which specs are running
83
+ # particularly slow.
84
+ config.profile_examples = 10
85
+
86
+ # Run specs in random order to surface order dependencies. If you find an
87
+ # order dependency and want to debug it, you can fix the order by providing
88
+ # the seed, which is printed after each run.
89
+ # --seed 1234
90
+ config.order = :random
91
+
92
+ # Seed global randomization in this process using the `--seed` CLI option.
93
+ # Setting this allows you to use `--seed` to deterministically reproduce
94
+ # test failures related to randomization by passing the same `--seed` value
95
+ # as the one that triggered the failure.
96
+ Kernel.srand config.seed
97
+ =end
98
+ end
metadata CHANGED
@@ -1,27 +1,32 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: largeCsvProcessing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcelo Dueñas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-16 00:00:00.000000000 Z
11
+ date: 2022-05-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: Simple script that processes and extracts csv files from a much larger
14
- file
13
+ description: Simple script that make a file.csv with books non editable in yurs rows
15
14
  email: duemarfra@gmail.com
16
15
  executables: []
17
16
  extensions: []
18
17
  extra_rdoc_files: []
19
18
  files:
19
+ - ".rspec"
20
+ - Gemfile
21
+ - Gemfile.lock
20
22
  - LICENSE
21
23
  - README.md
24
+ - autoEvaluacion.txt
25
+ - bin/rspec
22
26
  - lib/csv_generator.rb
23
- - lib/extractor/extractor.rb
24
- - lib/lector/lector.rb
27
+ - readmeEs.txt
28
+ - spec/generator_spec.rb
29
+ - spec/spec_helper.rb
25
30
  homepage: https://github.com/duemarfra/largeCsvProcessing.git
26
31
  licenses:
27
32
  - MIT
@@ -1,25 +0,0 @@
1
- require 'csv'
2
-
3
- puts '***Este es el programa que crea un archivo de EXTRACTO, extrae tantos millones del archivo de lectura original segun queramos***'
4
- puts 'INGRESE UN NUMERO Y OBTENDRA UN ARCHIVO CSV MUTIPLICADO POR MILLONES DE DICHO NUMERO (tiene que ser igual o menor que la lectura original)'
5
-
6
- class Extractor
7
-
8
- attr_accessor :nMillones
9
- @@libros = CSV.read('./lector.csv').map
10
- @@espacio = "\n"
11
-
12
- def nuevoExtracto
13
-
14
- nRepeticiones = ( @nMillones.to_i * 1_000_000 ) + 1
15
-
16
- nRepeticiones.times {
17
-
18
- File.open( './extracto.csv', 'a' ) { |row| row.write @@libros.next}
19
- File.open( './extracto.csv', 'a' ) { |row| row.write @@espacio}
20
-
21
- }
22
-
23
- end
24
-
25
- end
data/lib/lector/lector.rb DELETED
@@ -1,34 +0,0 @@
1
- require 'csv'
2
-
3
- puts '***Este es el programa que crea el archivo del control físico semanal de todos los libros del depósito***'
4
- puts 'INGRESE UN NUMERO Y OBTENDRA UN ARCHIVO CSV MUTIPLICADO POR MILLONES DE DICHO NUMERO'
5
-
6
- class Lector
7
-
8
- attr_accessor :nMillones
9
- @@cabecera = '"Date","ISBN","Amount"'
10
- @@book1 = '"2008-04-12","978-1-9343561-0-4",39.45'
11
- @@book2 = '"2008-04-13","978-1-9343561-6-6",45.67'
12
- @@book3 = '"2008-04-14","978-1-9343560-7-4",36.95'
13
- @@book4 = '"2008-04-15","978-1-9343560-9-9",40.69'
14
- @@espacio = "\n"
15
-
16
- def nuevaLectura
17
-
18
- File.open( './lector.csv', 'a' ) { |file| file.write @@cabecera+@@espacio }
19
-
20
- nRepeticiones = 1_000_000 * @nMillones.to_i / 4
21
-
22
-
23
- nRepeticiones.times {
24
-
25
- File.open( './lector.csv', 'a' ) { |file| file.write @@book1+@@espacio }
26
- File.open( './lector.csv', 'a' ) { |file| file.write @@book2+@@espacio }
27
- File.open( './lector.csv', 'a' ) { |file| file.write @@book3+@@espacio }
28
- File.open( './lector.csv', 'a' ) { |file| file.write @@book4+@@espacio }
29
-
30
- }
31
-
32
- end
33
-
34
- end