bad_encoding 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5748ce0913b7e7a218c97b1d5eb660eb7d2f6241
4
- data.tar.gz: baf741adf4554e277c56206bef1cb185cab509ed
3
+ metadata.gz: 7dd740580170821d850ea0a9d16728cad0da52d2
4
+ data.tar.gz: 1b30cf011079aa4da47f89dd107e0b5f19b54c25
5
5
  SHA512:
6
- metadata.gz: 6bcc79a24d610ebbb6c048eebedeb2087e7a80b929bf7d63bb6c10078e0e81713e53de334da4c88292ee8cb43638386271aabd00a5cd16464290ab2831aef23d
7
- data.tar.gz: 6333f4cf118af0d2c7334c1879f4c47472ba7d82c7b8bde03748faa1d4e3db035d6e05316bdda875199a04b14ddc0cd90fdb7db54f90f9b029049322d982fd89
6
+ metadata.gz: 3a8a28169d9abced0b0515dae98120e26d4ea4f26560754bdf311e168758f84ac932eb6cd9ab23c532c59648046704862d611a4d2d9e9aac222c05ce92630fb2
7
+ data.tar.gz: da7c113b5c9443bacb7dea8ca86f0a4678f1ab2b3c9dd9f4b3d507ec40f574551ba17514d5f9496eac0df26f290dab8a4c574ba714dafecf8c40f4df20fd5142
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # Bad Encoding
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/bad_encoding`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ I was having trouble finding bad characters in large strings so I did this manually for like 20 mins. Forget that! Never again!
6
4
 
7
5
  ## Installation
8
6
 
@@ -21,6 +19,7 @@ Or install it yourself as:
21
19
  $ gem install bad_encoding
22
20
 
23
21
  ## Usage
22
+ require 'bad_encoding'
24
23
 
25
24
  > good_string.show_bad_encoding
26
25
  => "no bad segments founds"
@@ -1,3 +1,3 @@
1
1
  module BadEncoding
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/bad_encoding.rb CHANGED
@@ -7,6 +7,7 @@ module BadEncoding
7
7
  end
8
8
 
9
9
  def search(s, &block)
10
+ return 'no bad segments found' unless block.call(s)
10
11
  process(s, block)
11
12
  end
12
13
 
@@ -19,17 +20,12 @@ module BadEncoding
19
20
  end_of_list = count - middle
20
21
 
21
22
  first_half = s.slice(0, middle)
22
- if check.call(first_half)
23
- return process(first_half, check)
24
- end
25
-
26
- second_half = s.slice(middle, end_of_list)
27
- if check.call(second_half)
28
- return process(second_half, check)
29
- end
30
-
31
- return 'no bad segments founds'
32
- end
23
+ return if check.call(first_half)
24
+ process(first_half, check)
25
+ else
26
+ second_half = s.slice(middle, end_of_list)
27
+ process(second_half, check)
28
+ end
33
29
  end
34
30
  end
35
31
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bad_encoding
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregory Ostermayr