readlines 1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/gem-push.yml +45 -0
  3. data/.gitignore +46 -0
  4. data/.rspec +0 -0
  5. data/CHANGELOG.md +36 -0
  6. data/CODE_OF_CONDUCT.md +0 -0
  7. data/Gemfile +5 -0
  8. data/Gemfile.lock +30 -0
  9. data/LICENSE +21 -0
  10. data/README.md +349 -0
  11. data/Rakefile +9 -0
  12. data/examples/example1.rb +13 -0
  13. data/examples/example10.rb +13 -0
  14. data/examples/example11.rb +13 -0
  15. data/examples/example12.rb +13 -0
  16. data/examples/example13.rb +13 -0
  17. data/examples/example14.rb +13 -0
  18. data/examples/example15.rb +13 -0
  19. data/examples/example16.rb +13 -0
  20. data/examples/example17.rb +13 -0
  21. data/examples/example18.rb +13 -0
  22. data/examples/example19.rb +13 -0
  23. data/examples/example2.rb +13 -0
  24. data/examples/example20.rb +13 -0
  25. data/examples/example21.rb +13 -0
  26. data/examples/example22.rb +13 -0
  27. data/examples/example23.rb +13 -0
  28. data/examples/example24.rb +13 -0
  29. data/examples/example25.rb +13 -0
  30. data/examples/example26.rb +13 -0
  31. data/examples/example27.rb +13 -0
  32. data/examples/example28.rb +13 -0
  33. data/examples/example29.rb +13 -0
  34. data/examples/example3.rb +13 -0
  35. data/examples/example30.rb +13 -0
  36. data/examples/example31.rb +13 -0
  37. data/examples/example32.rb +13 -0
  38. data/examples/example33.rb +13 -0
  39. data/examples/example34.rb +13 -0
  40. data/examples/example35.rb +13 -0
  41. data/examples/example36.rb +13 -0
  42. data/examples/example37.rb +13 -0
  43. data/examples/example38.rb +13 -0
  44. data/examples/example4.rb +13 -0
  45. data/examples/example5.rb +13 -0
  46. data/examples/example6.rb +13 -0
  47. data/examples/example7.rb +13 -0
  48. data/examples/example8.rb +13 -0
  49. data/examples/example9.rb +13 -0
  50. data/lib/read.rb +9 -0
  51. data/lib/readlines/read.rb +263 -0
  52. data/lib/readlines/readlines/check.rb +16 -0
  53. data/lib/readlines/readlines/content.rb +45 -0
  54. data/lib/readlines/readlines/convert.rb +43 -0
  55. data/lib/readlines/readlines/count.rb +58 -0
  56. data/lib/readlines/readlines/delete.rb +89 -0
  57. data/lib/readlines/readlines/error.rb +13 -0
  58. data/lib/readlines/readlines/file.rb +20 -0
  59. data/lib/readlines/readlines/info.rb +48 -0
  60. data/lib/readlines/readlines/merge.rb +38 -0
  61. data/lib/readlines/readlines/pattern.rb +22 -0
  62. data/lib/readlines/readlines/replace.rb +50 -0
  63. data/lib/readlines/readlines/search.rb +62 -0
  64. data/lib/readlines/readlines/sort.rb +18 -0
  65. data/lib/readlines/readlines/split.rb +79 -0
  66. data/lib/readlines/readlines/version.rb +7 -0
  67. data/readlines.gemspec +25 -0
  68. metadata +182 -0
@@ -0,0 +1,13 @@
1
+ require 'readlines'
2
+
3
+ # Create an instance of the ReadDuc
4
+ file_path = 'path/to/your/file.txt'
5
+ obj = Read.new(file_path)
6
+
7
+ # Example usage of the delete_csv_columns method
8
+ begin
9
+ result = obj.delete_csv_columns
10
+ puts "Result of delete_csv_columns: #{result}"
11
+ rescue => e
12
+ puts "Error: #{e.message}"
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'readlines'
2
+
3
+ # Create an instance of the ReadDuc
4
+ file_path = 'path/to/your/file.txt'
5
+ obj = Read.new(file_path)
6
+
7
+ # Example usage of the delete_right_left_separator method
8
+ begin
9
+ result = obj.delete_right_left_separator
10
+ puts "Result of delete_right_left_separator: #{result}"
11
+ rescue => e
12
+ puts "Error: #{e.message}"
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'readlines'
2
+
3
+ # Create an instance of the ReadDuc
4
+ file_path = 'path/to/your/file.txt'
5
+ obj = Read.new(file_path)
6
+
7
+ # Example usage of the character_count method
8
+ begin
9
+ result = obj.character_count
10
+ puts "Result of character_count: #{result}"
11
+ rescue => e
12
+ puts "Error: #{e.message}"
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'readlines'
2
+
3
+ # Create an instance of the ReadDuc
4
+ file_path = 'path/to/your/file.txt'
5
+ obj = Read.new(file_path)
6
+
7
+ # Example usage of the sort_alphabetically method
8
+ begin
9
+ result = obj.sort_alphabetically
10
+ puts "Result of sort_alphabetically: #{result}"
11
+ rescue => e
12
+ puts "Error: #{e.message}"
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'readlines'
2
+
3
+ # Create an instance of the ReadDuc
4
+ file_path = 'path/to/your/file.txt'
5
+ obj = Read.new(file_path)
6
+
7
+ # Example usage of the split_file method
8
+ begin
9
+ result = obj.split_file
10
+ puts "Result of split_file: #{result}"
11
+ rescue => e
12
+ puts "Error: #{e.message}"
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'readlines'
2
+
3
+ # Create an instance of the ReadDuc
4
+ file_path = 'path/to/your/file.txt'
5
+ obj = Read.new(file_path)
6
+
7
+ # Example usage of the split_file_by_size method
8
+ begin
9
+ result = obj.split_file_by_size
10
+ puts "Result of split_file_by_size: #{result}"
11
+ rescue => e
12
+ puts "Error: #{e.message}"
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'readlines'
2
+
3
+ # Create an instance of the ReadDuc
4
+ file_path = 'path/to/your/file.txt'
5
+ obj = Read.new(file_path)
6
+
7
+ # Example usage of the split_by_delimiter method
8
+ begin
9
+ result = obj.split_by_delimiter
10
+ puts "Result of split_by_delimiter: #{result}"
11
+ rescue => e
12
+ puts "Error: #{e.message}"
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'readlines'
2
+
3
+ # Create an instance of the ReadDuc
4
+ file_path = 'path/to/your/file.txt'
5
+ obj = Read.new(file_path)
6
+
7
+ # Example usage of the split_by_pattern method
8
+ begin
9
+ result = obj.split_by_pattern
10
+ puts "Result of split_by_pattern: #{result}"
11
+ rescue => e
12
+ puts "Error: #{e.message}"
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'readlines'
2
+
3
+ # Create an instance of the ReadDuc
4
+ file_path = 'path/to/your/file.txt'
5
+ obj = Read.new(file_path)
6
+
7
+ # Example usage of the merge_files method
8
+ begin
9
+ result = obj.merge_files
10
+ puts "Result of merge_files: #{result}"
11
+ rescue => e
12
+ puts "Error: #{e.message}"
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'readlines'
2
+
3
+ # Create an instance of the ReadDuc
4
+ file_path = 'path/to/your/file.txt'
5
+ obj = Read.new(file_path)
6
+
7
+ # Example usage of the merge_files_with_specific_line method
8
+ begin
9
+ result = obj.merge_files_with_specific_line
10
+ puts "Result of merge_files_with_specific_line: #{result}"
11
+ rescue => e
12
+ puts "Error: #{e.message}"
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'readlines'
2
+
3
+ # Create an instance of the ReadDuc
4
+ file_path = 'path/to/your/file.txt'
5
+ obj = Read.new(file_path)
6
+
7
+ # Example usage of the convert_encoding method
8
+ begin
9
+ result = obj.convert_encoding
10
+ puts "Result of convert_encoding: #{result}"
11
+ rescue => e
12
+ puts "Error: #{e.message}"
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'readlines'
2
+
3
+ # Create an instance of the ReadDuc
4
+ file_path = 'path/to/your/file.txt'
5
+ obj = Read.new(file_path)
6
+
7
+ # Example usage of the convert_to_format method
8
+ begin
9
+ result = obj.convert_to_format
10
+ puts "Result of convert_to_format: #{result}"
11
+ rescue => e
12
+ puts "Error: #{e.message}"
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'readlines'
2
+
3
+ # Create an instance of the ReadDuc
4
+ file_path = 'path/to/your/file.txt'
5
+ obj = Read.new(file_path)
6
+
7
+ # Example usage of the convert_to_array method
8
+ begin
9
+ result = obj.convert_to_array
10
+ puts "Result of convert_to_array: #{result}"
11
+ rescue => e
12
+ puts "Error: #{e.message}"
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'readlines'
2
+
3
+ # Create an instance of the ReadDuc
4
+ file_path = 'path/to/your/file.txt'
5
+ obj = Read.new(file_path)
6
+
7
+ # Example usage of the word_count method
8
+ begin
9
+ result = obj.word_count
10
+ puts "Result of word_count: #{result}"
11
+ rescue => e
12
+ puts "Error: #{e.message}"
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'readlines'
2
+
3
+ # Create an instance of the ReadDuc
4
+ file_path = 'path/to/your/file.txt'
5
+ obj = Read.new(file_path)
6
+
7
+ # Example usage of the file_size method
8
+ begin
9
+ result = obj.file_size
10
+ puts "Result of file_size: #{result}"
11
+ rescue => e
12
+ puts "Error: #{e.message}"
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'readlines'
2
+
3
+ # Create an instance of the ReadDuc
4
+ file_path = 'path/to/your/file.txt'
5
+ obj = Read.new(file_path)
6
+
7
+ # Example usage of the file_statistics method
8
+ begin
9
+ result = obj.file_statistics
10
+ puts "Result of file_statistics: #{result}"
11
+ rescue => e
12
+ puts "Error: #{e.message}"
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'readlines'
2
+
3
+ # Create an instance of the ReadDuc
4
+ file_path = 'path/to/your/file.txt'
5
+ obj = Read.new(file_path)
6
+
7
+ # Example usage of the pattern_exists? method
8
+ begin
9
+ result = obj.pattern_exists?
10
+ puts "Result of pattern_exists?: #{result}"
11
+ rescue => e
12
+ puts "Error: #{e.message}"
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'readlines'
2
+
3
+ # Create an instance of the ReadDuc
4
+ file_path = 'path/to/your/file.txt'
5
+ obj = Read.new(file_path)
6
+
7
+ # Example usage of the extract_patterns method
8
+ begin
9
+ result = obj.extract_patterns
10
+ puts "Result of extract_patterns: #{result}"
11
+ rescue => e
12
+ puts "Error: #{e.message}"
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'readlines'
2
+
3
+ # Create an instance of the ReadDuc
4
+ file_path = 'path/to/your/file.txt'
5
+ obj = Read.new(file_path)
6
+
7
+ # Example usage of the reverse_content method
8
+ begin
9
+ result = obj.reverse_content
10
+ puts "Result of reverse_content: #{result}"
11
+ rescue => e
12
+ puts "Error: #{e.message}"
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'readlines'
2
+
3
+ # Create an instance of the ReadDuc
4
+ file_path = 'path/to/your/file.txt'
5
+ obj = Read.new(file_path)
6
+
7
+ # Example usage of the validate_content method
8
+ begin
9
+ result = obj.validate_content
10
+ puts "Result of validate_content: #{result}"
11
+ rescue => e
12
+ puts "Error: #{e.message}"
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'readlines'
2
+
3
+ # Create an instance of the ReadDuc
4
+ file_path = 'path/to/your/file.txt'
5
+ obj = Read.new(file_path)
6
+
7
+ # Example usage of the check_spelling method
8
+ begin
9
+ result = obj.check_spelling
10
+ puts "Result of check_spelling: #{result}"
11
+ rescue => e
12
+ puts "Error: #{e.message}"
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'readlines'
2
+
3
+ # Create an instance of the ReadDuc
4
+ file_path = 'path/to/your/file.txt'
5
+ obj = Read.new(file_path)
6
+
7
+ # Example usage of the encrypt_content method
8
+ begin
9
+ result = obj.encrypt_content
10
+ puts "Result of encrypt_content: #{result}"
11
+ rescue => e
12
+ puts "Error: #{e.message}"
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'readlines'
2
+
3
+ # Create an instance of the ReadDuc
4
+ file_path = 'path/to/your/file.txt'
5
+ obj = Read.new(file_path)
6
+
7
+ # Example usage of the decrypt_content method
8
+ begin
9
+ result = obj.decrypt_content
10
+ puts "Result of decrypt_content: #{result}"
11
+ rescue => e
12
+ puts "Error: #{e.message}"
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'readlines'
2
+
3
+ # Create an instance of the ReadDuc
4
+ file_path = 'path/to/your/file.txt'
5
+ obj = Read.new(file_path)
6
+
7
+ # Example usage of the read_lines method
8
+ begin
9
+ result = obj.read_lines
10
+ puts "Result of read_lines: #{result}"
11
+ rescue => e
12
+ puts "Error: #{e.message}"
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'readlines'
2
+
3
+ # Create an instance of the ReadDuc
4
+ file_path = 'path/to/your/file.txt'
5
+ obj = Read.new(file_path)
6
+
7
+ # Example usage of the info method
8
+ begin
9
+ result = obj.info
10
+ puts "Result of info: #{result}"
11
+ rescue => e
12
+ puts "Error: #{e.message}"
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'readlines'
2
+
3
+ # Create an instance of the ReadDuc
4
+ file_path = 'path/to/your/file.txt'
5
+ obj = Read.new(file_path)
6
+
7
+ # Example usage of the search_about method
8
+ begin
9
+ result = obj.search_about
10
+ puts "Result of search_about: #{result}"
11
+ rescue => e
12
+ puts "Error: #{e.message}"
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'readlines'
2
+
3
+ # Create an instance of the ReadDuc
4
+ file_path = 'path/to/your/file.txt'
5
+ obj = ReadDuc.new(file_path)
6
+
7
+ # Example usage of the search_multiple_patterns method
8
+ begin
9
+ result = obj.search_multiple_patterns
10
+ puts "Result of search_multiple_patterns: #{result}"
11
+ rescue => e
12
+ puts "Error: #{e.message}"
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'readlines'
2
+
3
+ # Create an instance of the ReadDuc
4
+ file_path = 'path/to/your/file.txt'
5
+ obj = Read.new(file_path)
6
+
7
+ # Example usage of the search_in_range method
8
+ begin
9
+ result = obj.search_in_range
10
+ puts "Result of search_in_range: #{result}"
11
+ rescue => e
12
+ puts "Error: #{e.message}"
13
+ end
@@ -0,0 +1,13 @@
1
+ require 'readlines'
2
+
3
+ # Create an instance of the ReadDuc
4
+ file_path = 'path/to/your/file.txt'
5
+ obj = Read.new(file_path)
6
+
7
+ # Example usage of the search_logical_patterns method
8
+ begin
9
+ result = obj.search_logical_patterns
10
+ puts "Result of search_logical_patterns: #{result}"
11
+ rescue => e
12
+ puts "Error: #{e.message}"
13
+ end
data/lib/read.rb ADDED
@@ -0,0 +1,9 @@
1
+ # readlines/lib/read.rb
2
+ # lib/read.rb
3
+ require_relative 'readlines/read'
4
+
5
+ module Read
6
+ def self.new(file_path, count: nil, split: nil)
7
+ Readlines::ReadDuc.new(file_path, count: count, split: split)
8
+ end
9
+ end