lstrip-on-steroids 0.1 → 0.9
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.
- data/Rakefile +1 -1
- data/lib/lstrip_on_steroids.rb +5 -12
- metadata +4 -4
data/Rakefile
CHANGED
data/lib/lstrip_on_steroids.rb
CHANGED
@@ -1,17 +1,10 @@
|
|
1
1
|
module LStripOnSteroids
|
2
2
|
def -@
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
leading_whitespace = lines.delete_at(-1)
|
9
|
-
# Strip leading_whitespace from each line and join into one again
|
10
|
-
lines.map do |l|
|
11
|
-
i = leading_whitespace.length
|
12
|
-
l[/^ {#{i}}/] = "" if l[/^ {#{i}}/]
|
13
|
-
l
|
14
|
-
end.join("\n")
|
3
|
+
lines = split("\n")[1...-1]
|
4
|
+
leading_whitespace = lines.map { |line| line.match(/^ */)[0].length }.min
|
5
|
+
lines.map { |line|
|
6
|
+
line.sub(/^ {#{leading_whitespace}}/, "")
|
7
|
+
}.join("\n")
|
15
8
|
end
|
16
9
|
end
|
17
10
|
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lstrip-on-steroids
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: "0.
|
8
|
+
- 9
|
9
|
+
version: "0.9"
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Caius Durling
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-08-
|
17
|
+
date: 2010-08-19 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|