mt_line_eraser 0.0.2
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 +7 -0
- data/lib/mt_line_eraser.rb +15 -0
- metadata +43 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '08d16c3ee16884274e70cac163264e22c2d91db82f0cd82ec44dd455da3e4c29'
|
4
|
+
data.tar.gz: 8a28cd54248e281d5939e906c25d8ee643683412801a58f018568eb88a5336d5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b330f30d58a10286f9deacf3280861d01070344f4f57c7d671be6a0fe79929e218c5646ce9d8c5aa0a73a2e0f7c30a88a21f51958862ca41d2e26ee9b9b818b0
|
7
|
+
data.tar.gz: afa548b553fc0714bf815bfb9b663a95c38874dbbd56ebed36bf276ab91497e2c9146285d1861acf15f01fa6fa16107f7dcb179a7f739124980c6c399bad364a
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class MtLineEraser
|
2
|
+
class << self
|
3
|
+
def erase_in(file_name_with_path)
|
4
|
+
return "Invalid File path" unless File.exists?(file_name_with_path)
|
5
|
+
original_file = File.open(file_name_with_path, 'r')
|
6
|
+
clone_file = File.open(file_name_with_path + '.clone', 'w')
|
7
|
+
original_file.readlines.each do |line|
|
8
|
+
clone_file.write(line) if line.gsub(/^[\s|\n]*/, '') != ''
|
9
|
+
end
|
10
|
+
[original_file, clone_file].map{|_file| _file.close}
|
11
|
+
File.rename(clone_file, original_file)
|
12
|
+
"Erased all the empty lines from #{file_name_with_path}"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
metadata
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mt_line_eraser
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Subash R
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-12-11 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email:
|
15
|
+
- waytosubash@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- lib/mt_line_eraser.rb
|
21
|
+
homepage:
|
22
|
+
licenses: []
|
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
|
+
rubygems_version: 3.3.7
|
40
|
+
signing_key:
|
41
|
+
specification_version: 4
|
42
|
+
summary: A gem to erase the empty lines from any given file
|
43
|
+
test_files: []
|