BF2LF 0.0.1

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 (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/BF2LF.rb +52 -0
  3. metadata +46 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b50adead4d61d7d8ee0da9855746c03833b465c3
4
+ data.tar.gz: cf30a6601bc7dfbabe31f86630d5034ada792522
5
+ SHA512:
6
+ metadata.gz: 068b3a95821170c094e5189fdff58965fad3f8baa349725910c5eccde6bc86310b86f3c0ec4629f512b5df9a10ff275182f51b6a4498f374110c79a9a1ab7f13
7
+ data.tar.gz: 14e839e0e9d256d1ea2a6af89889d1d5dbcf58c8b6d29ca79a7e714eb5a60697f17e969feb8295406219992cc9d70a109293b79958d4f74d2cc5f647ae3a04ff
@@ -0,0 +1,52 @@
1
+ # Tommy Mertell :)
2
+
3
+ public
4
+ def bigfsw(character_size,tmp_dir)
5
+
6
+ tmp_dir = tmp_dir
7
+ c_s = character_size
8
+ b_f_s_w = self
9
+
10
+ def format_big_file
11
+ # This function servers to turn whatever file it is handed and make it into an array.
12
+
13
+ file = self
14
+ file_to_array = File.open("#{file}").each_char.to_a
15
+ end
16
+
17
+ def split_and_write_file(cs, tmp_dir)
18
+ # variables to gather the array, create a temporary directory, and split on character size
19
+
20
+ file = self
21
+ tmp_dir = tmp_dir
22
+ cs = cs
23
+
24
+ #This variable serves for pulling out the appropriate single dimensional array from the new_multi_array
25
+
26
+ count = 0
27
+
28
+ # The new_multi_array is a container, multi-dimensional array that will hold singular arrays that were divided from the file_to_array based on character size
29
+
30
+ new_multi_array = []
31
+ file.each_slice(cs) do |slice|
32
+ new_multi_array << slice
33
+ end
34
+
35
+ # This is where the temporary directory is made, then if either the location exists, or doesn't exist, then the singular arrays from new_multi_array are pulled from the multi-array and written into the file in a serialized form
36
+ # C:\\tmp\\
37
+ # new_multi_array[1] === tmp1.txt
38
+ # C:\\tmp\\tmp1.txt
39
+
40
+ while count <= new_multi_array.length
41
+ if Dir.exist?("#{tmp_dir}")
42
+ File.open("#{tmp_dir}/tmp#{count}.txt", "w") { |file| file.write(new_multi_array[count]) }
43
+ else
44
+ Dir.mkdir("#{tmp_dir}")
45
+ File.open("#{tmp_dir}/tmp#{count}.txt", "w") { |file| file.write(new_multi_array[count]) }
46
+ end
47
+ count += 1
48
+ end
49
+ end
50
+ #This line allows the method to be called by using a single mixin
51
+ b_f_s_w.format_big_file.split_and_write_file(c_s, tmp_dir)
52
+ end
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: BF2LF
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Tommy Mertell
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-04-12 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Big File to Little File
14
+ email: sinithw@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/BF2LF.rb
20
+ homepage: http://rubygems.org/gems/BF2LF
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubyforge_project:
40
+ rubygems_version: 2.4.5.1
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: This gem is a mixin that allows the user to take a big file and break it
44
+ down into smaller chunk files for iteration in an attempt to reduce overhead memory
45
+ bufferhead.
46
+ test_files: []