eraser 0.0.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 +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +46 -0
- data/Rakefile +6 -0
- data/eraser.gemspec +23 -0
- data/lib/eraser.rb +11 -0
- data/lib/eraser/line_terminators.rb +14 -0
- data/lib/eraser/space_separators.rb +32 -0
- data/lib/eraser/version.rb +3 -0
- metadata +98 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b05e5334315b9015bb6d6fff3a5861914c5e378f
|
4
|
+
data.tar.gz: 8c390352c6bca11730296feaa14442945c0a6535
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1dba36485e187f69a74a0bea35d6a0706f1191f69b4f7d76c3fe40d24c65be31b0f53cfc95b54af7adb288dff312c7bb211e6952f2450aa25bfb5569da8615e5
|
7
|
+
data.tar.gz: f9f03515eed7b0c44aa8acb0dc7de9936dcba7d9c4ae99a64274559aa4c417bb227d2af5a434613109b147d0715892240c5aaa67572dcdc89e4109501cb65b1a
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Steel Fu
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# Eraser
|
2
|
+
|
3
|
+
Erase or replace unicode space separators and line terminators.
|
4
|
+
|
5
|
+
Sepace separators are replaced with a space and line terminators are replaced with a newline.
|
6
|
+
|
7
|
+
Inspired by [https://github.com/roysharon/uninums](https://github.com/roysharon/uninums)
|
8
|
+
|
9
|
+
## Plot
|
10
|
+
|
11
|
+
John Kruger is a U.S. Marshal working for the Space Line Protection Program (SLPP) specializing in "erasing" controversial characters and replacing them with puppets for their safety...
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
Add this line to your application's Gemfile:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
gem 'eraser'
|
19
|
+
```
|
20
|
+
|
21
|
+
And then execute:
|
22
|
+
|
23
|
+
$ bundle
|
24
|
+
|
25
|
+
Or install it yourself as:
|
26
|
+
|
27
|
+
$ gem install eraser
|
28
|
+
|
29
|
+
## Usage
|
30
|
+
|
31
|
+
TODO: Write usage instructions here
|
32
|
+
|
33
|
+
## Development
|
34
|
+
|
35
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
36
|
+
|
37
|
+
To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
38
|
+
|
39
|
+
## Contributing
|
40
|
+
|
41
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/polleverywhere/eraser.
|
42
|
+
|
43
|
+
## License
|
44
|
+
|
45
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
46
|
+
|
data/Rakefile
ADDED
data/eraser.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'eraser/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "eraser"
|
8
|
+
spec.version = Eraser::VERSION
|
9
|
+
spec.authors = ["Steel Fu"]
|
10
|
+
spec.email = ["steelfu@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Erase or replace unicode space separators and line terminators.}
|
13
|
+
spec.description = %q{Erase or replace unicode space separators and line terminators.}
|
14
|
+
spec.homepage = "https://github.com/polleverywhere/eraser"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
21
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
22
|
+
spec.add_development_dependency "rspec"
|
23
|
+
end
|
data/lib/eraser.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
module Eraser
|
2
|
+
module LineTerminators
|
3
|
+
# \u000A Line Feed (‘\n’)
|
4
|
+
# \u000D Carriage Return (‘\r’)
|
5
|
+
# \u2028 Line separator
|
6
|
+
# \u2029 Paragraph separator
|
7
|
+
|
8
|
+
REGEX = /\r\n|[\n\r\u2028\u2029]/
|
9
|
+
|
10
|
+
def self.erase(value, replace_with = "\n")
|
11
|
+
value.gsub REGEX, replace_with
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Eraser
|
2
|
+
module SpaceSeparators
|
3
|
+
# \u0009 Tab
|
4
|
+
# \u000B Vertical Tab (‘\v’)
|
5
|
+
# \u000C Form Feed (‘\f’)
|
6
|
+
# \u0020 Space (‘ ‘)
|
7
|
+
# \u00A0 No-break space
|
8
|
+
# \uFEFF Byte Order Mark
|
9
|
+
# \u1680 Ogham Space Mark
|
10
|
+
# \u180E Mongolian Vowel Separator
|
11
|
+
# \u2000 En Quad
|
12
|
+
# \u2001 Em Quad
|
13
|
+
# \u2002 En Space
|
14
|
+
# \u2003 Em Space
|
15
|
+
# \u2004 Three-per-em space
|
16
|
+
# \u2005 Four-per-em space
|
17
|
+
# \u2006 Six-per-em space
|
18
|
+
# \u2007 Figure space
|
19
|
+
# \u2008 Punctuation space
|
20
|
+
# \u2009 Thin space
|
21
|
+
# \u200A Hair space
|
22
|
+
# \u202F Narrow no-break space
|
23
|
+
# \u205F Medium mathematical space
|
24
|
+
# \u3000 Ideographic space
|
25
|
+
|
26
|
+
REGEX = /[\t\v\f\u0020\u00A0\uFEFF\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000]/
|
27
|
+
|
28
|
+
def self.erase(value, replace_with = " ")
|
29
|
+
value.gsub REGEX, replace_with
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: eraser
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Steel Fu
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-08-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Erase or replace unicode space separators and line terminators.
|
56
|
+
email:
|
57
|
+
- steelfu@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".travis.yml"
|
65
|
+
- Gemfile
|
66
|
+
- LICENSE.txt
|
67
|
+
- README.md
|
68
|
+
- Rakefile
|
69
|
+
- eraser.gemspec
|
70
|
+
- lib/eraser.rb
|
71
|
+
- lib/eraser/line_terminators.rb
|
72
|
+
- lib/eraser/space_separators.rb
|
73
|
+
- lib/eraser/version.rb
|
74
|
+
homepage: https://github.com/polleverywhere/eraser
|
75
|
+
licenses:
|
76
|
+
- MIT
|
77
|
+
metadata: {}
|
78
|
+
post_install_message:
|
79
|
+
rdoc_options: []
|
80
|
+
require_paths:
|
81
|
+
- lib
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
requirements: []
|
93
|
+
rubyforge_project:
|
94
|
+
rubygems_version: 2.2.3
|
95
|
+
signing_key:
|
96
|
+
specification_version: 4
|
97
|
+
summary: Erase or replace unicode space separators and line terminators.
|
98
|
+
test_files: []
|