tiny_sweeper 1.0.1 → 1.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: cc45514a814079d62fd12cb51ce7871480c6d481
4
- data.tar.gz: d7649543e8326e74d7b4d973b8d9c058c692da99
2
+ SHA256:
3
+ metadata.gz: 599a8b0b38962996eab15aa3315a040ffa0a3c444153541e5b5e542d73a5f497
4
+ data.tar.gz: f90bec0b3214f1591434b377dc0dc5aa8883dcb9074a348a873cba23af87fe3b
5
5
  SHA512:
6
- metadata.gz: a63c4fad74b38310816685b170bb577c41baaac4174d07cbd8deafc7217b7b576fc7b582035afd4d06362158d4a6d47028265f89b0f98f5853d6b1cbe0e849af
7
- data.tar.gz: 28ded9dedbf9e05f67a51b23e6d19c4ccfc90d924d526d3fe007cf6034a9fafd7b2dfbcecb7d5e50b2ed09ed6bfa8c340ea639880ec86010027bfdf69dd6921d
6
+ metadata.gz: fc866c38d0e0432ea00dc31d14ca316e3d19c83b81f92d5ebb58afba9b7a9d85a44f5716e205f47ee83965ea8aa6b656269be4c61555ec6b453a66458eb4a4f3
7
+ data.tar.gz: 3fb0dfd7aa4d92517643fc8793911577b80ce3a6fab5a641cef17b45aa12a820bae0aebe7336d3bdeafa79a2f42b3955b66b1d704f7b3da56b4ba45effc672f5
data/ChangeLog CHANGED
@@ -1,3 +1,11 @@
1
+ tiny_sweeper (1.1.1) stable; urgency=low
2
+
3
+ * Add `:nbsp` broom for removing non breaking space characters
4
+
5
+ tiny_sweeper (1.1.0) stable; urgency=low
6
+
7
+ * Change strip to remove UTF-8 NBSP
8
+
1
9
  tiny_sweeper (1.0.1) stable; urgency=low
2
10
 
3
11
  * Fix gemspec warnings:
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tiny_sweeper (0.0.5)
4
+ tiny_sweeper (1.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -37,9 +37,9 @@ PLATFORMS
37
37
  DEPENDENCIES
38
38
  bundler (~> 1.5)
39
39
  codeclimate-test-reporter
40
- rake
41
- rspec
40
+ rake (~> 10.0)
41
+ rspec (~> 3.0)
42
42
  tiny_sweeper!
43
43
 
44
44
  BUNDLED WITH
45
- 1.12.5
45
+ 1.16.1
data/README.md CHANGED
@@ -89,6 +89,7 @@ TinySweeper currently only knows a few tricks...
89
89
  * `blanks_to_nil`: turn empty strings into nils
90
90
  * `strip`: just like `String#strip`: removes trailing and leading whitespace
91
91
  * `dumb_quotes`: replace [Smart Quotes](https://en.wikipedia.org/wiki/Quotation_marks_in_English) with their simpler siblings
92
+ * `nbsp`: replace [non breaking space characters](https://www.w3.org/MarkUp/HTMLPlus/htmlplus_13.html) with an empty string
92
93
 
93
94
  ...but you can teach it new ones:
94
95
 
@@ -30,6 +30,10 @@ module TinySweeper
30
30
 
31
31
  value
32
32
  end
33
+
34
+ def self.nbsp(value)
35
+ value && value.gsub("\u00A0", "")
36
+ end
33
37
  end
34
38
 
35
39
  BroomCloset.methods.each do |broom|
@@ -1,3 +1,3 @@
1
1
  module TinySweeper
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.1"
3
3
  end
@@ -22,6 +22,12 @@ RSpec.describe 'the brooms in the BroomCloset' do
22
22
  end
23
23
  end
24
24
 
25
+ describe 'nbsp' do
26
+ it 'handles nbsp' do
27
+ expect(TinySweeper::BroomCloset.nbsp("foo\u00A0bar")).to eq('foobar')
28
+ end
29
+ end
30
+
25
31
  describe 'dumb_quotes' do
26
32
  it 'replaces smart quotes with dumb quotes in strings' do
27
33
  expect(TinySweeper::BroomCloset.dumb_quotes("abc‘")).to eq(%q{abc'})
@@ -1,10 +1,11 @@
1
1
  RSpec.describe 'cleaning fields' do
2
2
  class Contract
3
- attr_accessor :name, :notes
3
+ attr_accessor :name, :notes, :addendum
4
4
 
5
5
  include TinySweeper
6
6
  sweep :notes, &:strip
7
7
  sweep(:name) { |n| n.upcase }
8
+ sweep :addendum, :nbsp
8
9
  end
9
10
 
10
11
  it 'strips notes' do
@@ -19,6 +20,12 @@ RSpec.describe 'cleaning fields' do
19
20
  expect(contract.name).to eq('GONNA SHOUT IT')
20
21
  end
21
22
 
23
+ it 'removes nbsps from the addendum' do
24
+ contract = Contract.new
25
+ contract.addendum = "foo\u00A0bar"
26
+ expect(contract.addendum).to eq('foobar')
27
+ end
28
+
22
29
  it "lets nils through without complaint. nil is YOUR job to handle." do
23
30
  contract = Contract.new
24
31
  expect {
@@ -2,6 +2,7 @@
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'tiny_sweeper/version'
5
+ require 'date'
5
6
 
6
7
  Gem::Specification.new do |s|
7
8
  s.name = 'tiny_sweeper'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiny_sweeper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Bernier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-11 00:00:00.000000000 Z
11
+ date: 2018-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
102
  version: '0'
103
103
  requirements: []
104
104
  rubyforge_project:
105
- rubygems_version: 2.5.1
105
+ rubygems_version: 2.7.6
106
106
  signing_key:
107
107
  specification_version: 4
108
108
  summary: A tiny helper to clean your inputs