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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b40e977ff67d4b2be073bb2d7e47ebe535f41599
4
- data.tar.gz: ebadc5579bfba703ea16c8979806685a40d4097d
3
+ metadata.gz: 630a614947e9f825853b5464c9b0de9be774fa46
4
+ data.tar.gz: d40314ec496e4b715823fdfd273d90da9806f97a
5
5
  SHA512:
6
- metadata.gz: 2f83fa5f597d19e209030c1e3bf22095d55e7a17a48625c3bb6271c1bb8897d5c985bf0f28b1d95c56d38179ec19e707ce662831083cc9282fb329246f547f8d
7
- data.tar.gz: 014a3e54b2aed5ddc4711530b363dcbd6a10e35f97909148f4529a8c577e503a2e6206c73aa366d12a6cc92f33c88bb0ab8f8a5fd9434857607dffa9b0c64162
6
+ metadata.gz: 30861065424bb5d2f8c0b3425950828369dbc1dd345ec73697264925ae6478567652bd3446ad6a8fc68eaa5300c1fd221d9c98c43e68446ac023f2efe130202f
7
+ data.tar.gz: e131af061368445210012157369ffe93cecdfa581a991c4f2963b8f7d71b8126e7917cb8cd7e05956e8aabb594b6d6581102fc0df85182af8761944047112667
@@ -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
@@ -1,7 +1,7 @@
1
1
  module FatCore
2
2
  MAJOR = 0
3
3
  MINOR = 4
4
- PATCH = 1
4
+ PATCH = 2
5
5
 
6
6
  VERSION = [MAJOR, MINOR, PATCH].compact.join('.')
7
7
  end
data/spec/lib/nil_spec.rb CHANGED
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe NilClass do
4
4
  it "should respond to entitle" do
5
- expect(nil.entitle).to eq nil
5
+ expect(nil.entitle).to eq ''
6
6
  end
7
7
 
8
8
  it "should respond to tex_quote" do
@@ -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.1
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-01 00:00:00.000000000 Z
11
+ date: 2015-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simplecov