Indentinator 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/indentinator.rb +3 -1
  2. data/test/tests.rb +13 -0
  3. metadata +4 -4
data/lib/indentinator.rb CHANGED
@@ -58,7 +58,9 @@ def convert_lines(lines, from, to)
58
58
  end
59
59
  end
60
60
  indents.push(diff)
61
- indents.map{|i| (i == from or i == "\t") ? to : i }.join + rest
61
+ indents
62
+ .map{|i| i ? i.gsub("\t", to) : i }
63
+ .map{|i| i == from ? to : i }.join + rest
62
64
  end
63
65
  end
64
66
 
data/test/tests.rb CHANGED
@@ -238,4 +238,17 @@ line 4"
238
238
  " line 3"
239
239
  ]
240
240
  end
241
+
242
+ it "tabs should be converted always(2)" do
243
+ lines = [
244
+ "line 1",
245
+ " line 2",
246
+ "\t\tline 3"
247
+ ]
248
+ convert_lines(lines, ' ' * 2, ' ' * 4).should == [
249
+ "line 1",
250
+ " line 2",
251
+ " line 3"
252
+ ]
253
+ end
241
254
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Indentinator
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 5
10
- version: 0.0.5
9
+ - 6
10
+ version: 0.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Toby Ho
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-29 00:00:00 -04:00
18
+ date: 2011-04-02 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency