fat_core 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fat_core/string.rb +6 -0
- data/lib/fat_core/version.rb +1 -1
- data/spec/lib/nil_spec.rb +1 -1
- data/spec/lib/string_spec.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 630a614947e9f825853b5464c9b0de9be774fa46
|
4
|
+
data.tar.gz: d40314ec496e4b715823fdfd273d90da9806f97a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30861065424bb5d2f8c0b3425950828369dbc1dd345ec73697264925ae6478567652bd3446ad6a8fc68eaa5300c1fd221d9c98c43e68446ac023f2efe130202f
|
7
|
+
data.tar.gz: e131af061368445210012157369ffe93cecdfa581a991c4f2963b8f7d71b8126e7917cb8cd7e05956e8aabb594b6d6581102fc0df85182af8761944047112667
|
data/lib/fat_core/string.rb
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
require 'damerau-levenshtein'
|
2
2
|
|
3
3
|
class String
|
4
|
+
# Remove leading and trailing white space and compress internal runs of
|
5
|
+
# white space to a single space.
|
6
|
+
def clean
|
7
|
+
self.strip.squeeze(' ')
|
8
|
+
end
|
9
|
+
|
4
10
|
def distance(other, block_size: 1, max_distance: 10)
|
5
11
|
dl = DamerauLevenshtein
|
6
12
|
# NOTE: DL 'gives up after' max_distance, so the distance function
|
data/lib/fat_core/version.rb
CHANGED
data/spec/lib/nil_spec.rb
CHANGED
data/spec/lib/string_spec.rb
CHANGED
@@ -64,6 +64,10 @@ the people, for the people, shall not perish from the earth."
|
|
64
64
|
end
|
65
65
|
|
66
66
|
describe "instance methods" do
|
67
|
+
it "should be able to clean up white space in a string" do
|
68
|
+
expect(' string here '.clean).to eq 'string here'
|
69
|
+
end
|
70
|
+
|
67
71
|
it "should be able to convert a digital date to iso form" do
|
68
72
|
expect("20140521".digdate2iso).to eq '2014-05-21'
|
69
73
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fat_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel E. Doherty
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: simplecov
|