hurricane_trimar 0.1.0
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 +11 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +35 -0
- data/LICENSE.txt +21 -0
- data/README.md +81 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/hurricane_trimar.gemspec +39 -0
- data/lib/hurricane_trimar.rb +20 -0
- data/lib/hurricane_trimar/version.rb +5 -0
- metadata +100 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5e2af82661fa5f51aa0791476adce9055d22ca0225a1d98fcfebb375905b1e32
|
4
|
+
data.tar.gz: f75c9ab9181577c4405fc177dd30eaebe91071c7b8ae819534bb266c53536dcf
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e7c94db371689c7beedd7e6e03dee3109e043a93add41b632c32050513145535d5261d6a854d3c85dd42a059de56f02339033986287c5581d6d7fd61c474f172
|
7
|
+
data.tar.gz: 9c10a08ee222b73ca70ce1262427aea6326d14729e655d88e06011bb0134caf6bc150b6e6417047c5c1294468974d822e9737be1678140c78dea615dedde82f3
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
hurricane_trimar (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
diff-lcs (1.3)
|
10
|
+
rake (10.5.0)
|
11
|
+
rspec (3.8.0)
|
12
|
+
rspec-core (~> 3.8.0)
|
13
|
+
rspec-expectations (~> 3.8.0)
|
14
|
+
rspec-mocks (~> 3.8.0)
|
15
|
+
rspec-core (3.8.1)
|
16
|
+
rspec-support (~> 3.8.0)
|
17
|
+
rspec-expectations (3.8.4)
|
18
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
19
|
+
rspec-support (~> 3.8.0)
|
20
|
+
rspec-mocks (3.8.1)
|
21
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
22
|
+
rspec-support (~> 3.8.0)
|
23
|
+
rspec-support (3.8.2)
|
24
|
+
|
25
|
+
PLATFORMS
|
26
|
+
ruby
|
27
|
+
|
28
|
+
DEPENDENCIES
|
29
|
+
bundler (~> 2.0)
|
30
|
+
hurricane_trimar!
|
31
|
+
rake (~> 10.0)
|
32
|
+
rspec (~> 3.0)
|
33
|
+
|
34
|
+
BUNDLED WITH
|
35
|
+
2.0.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 masatoshi_moritsuka
|
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,81 @@
|
|
1
|
+
# HurricaneTrimar
|
2
|
+
|
3
|
+
This gem adds methods for trimming spaces to `String`, using `[:space:]` POSIX character class.
|
4
|
+
Trimmed spaces by this gem are below.
|
5
|
+
|
6
|
+
|Character|Name|
|
7
|
+
|---|---|
|
8
|
+
|U+0009|Character tabulation|
|
9
|
+
|U+000A|Line feed|
|
10
|
+
|U+000B|Vertical tabulation|
|
11
|
+
|U+000C|Form feed|
|
12
|
+
|U+000D|Carriage return|
|
13
|
+
|U+0020|Space|
|
14
|
+
|U+00A0|No-break space|
|
15
|
+
|U+0085|Next line|
|
16
|
+
|U+1680|Ogham space mark|
|
17
|
+
|U+2000|En quad|
|
18
|
+
|U+2001|Em quad|
|
19
|
+
|U+2002|En space|
|
20
|
+
|U+2003|Em space|
|
21
|
+
|U+2004|Three-per-em space|
|
22
|
+
|U+2005|Four-per-em space|
|
23
|
+
|U+2006|Six-per-em space|
|
24
|
+
|U+2007|Figure space|
|
25
|
+
|U+2008|Punctuation space|
|
26
|
+
|U+2009|Thin space|
|
27
|
+
|U+200A|Hair space|
|
28
|
+
|U+202F|Narrow no-break space|
|
29
|
+
|U+205F|Medium mathematical space|
|
30
|
+
|U+2028|Line separator|
|
31
|
+
|U+2029|Paragraph separator|
|
32
|
+
|U+3000|Ideographic space|
|
33
|
+
|
34
|
+
## Installation
|
35
|
+
|
36
|
+
Add this line to your application's Gemfile:
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
gem 'hurricane_trimar'
|
40
|
+
```
|
41
|
+
|
42
|
+
And then execute:
|
43
|
+
|
44
|
+
$ bundle
|
45
|
+
|
46
|
+
Or install it yourself as:
|
47
|
+
|
48
|
+
$ gem install hurricane_trimar
|
49
|
+
|
50
|
+
## Usage
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
<<STR.trim
|
54
|
+
\u0020\u3000
|
55
|
+
\u0020\u3000Hello World\u0020\u3000
|
56
|
+
\u3000\u0020
|
57
|
+
STR
|
58
|
+
# => "Hello World"
|
59
|
+
|
60
|
+
<<STR.ltrim
|
61
|
+
\u0020\u3000
|
62
|
+
\u0020\u3000Hello World\u0020\u3000
|
63
|
+
\u3000\u0020
|
64
|
+
STR
|
65
|
+
# => "Hello World\n\u3000\u0020\n"
|
66
|
+
|
67
|
+
<<STR.rtrim
|
68
|
+
\u0020\u3000
|
69
|
+
\u0020\u3000Hello World\u0020\u3000
|
70
|
+
\u3000\u0020
|
71
|
+
STR
|
72
|
+
# => "\u0020\u3000\nHello World"
|
73
|
+
```
|
74
|
+
|
75
|
+
## Contributing
|
76
|
+
|
77
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/sanfrecce-osaka/hurricane_trimar.
|
78
|
+
|
79
|
+
## License
|
80
|
+
|
81
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "hurricane_trimar"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'hurricane_trimar/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'hurricane_trimar'
|
8
|
+
spec.version = HurricaneTrimar::VERSION
|
9
|
+
spec.authors = ['masatoshi_moritsuka']
|
10
|
+
spec.email = ['yakiyaki_ikayaki@yahoo.co.jp']
|
11
|
+
|
12
|
+
spec.summary = 'This gem trims spaces of posix character class.'
|
13
|
+
spec.description = 'This gem provides methods for trimming spaces.'
|
14
|
+
spec.homepage = 'https://github.com/sanfrecce-osaka/hurricane_trimar'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
21
|
+
spec.metadata['source_code_uri'] = spec.homepage
|
22
|
+
else
|
23
|
+
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
24
|
+
'public gem pushes.'
|
25
|
+
end
|
26
|
+
|
27
|
+
# Specify which files should be added to the gem when it is released.
|
28
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
29
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
30
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
31
|
+
end
|
32
|
+
spec.bindir = 'exe'
|
33
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
34
|
+
spec.require_paths = ['lib']
|
35
|
+
|
36
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
37
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
38
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
39
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'hurricane_trimar/version'
|
4
|
+
|
5
|
+
module HurricaneTrimmer
|
6
|
+
end
|
7
|
+
|
8
|
+
class String
|
9
|
+
def trim
|
10
|
+
ltrim.rtrim
|
11
|
+
end
|
12
|
+
|
13
|
+
def ltrim
|
14
|
+
gsub(%r(\A[[:space:]]*), '')
|
15
|
+
end
|
16
|
+
|
17
|
+
def rtrim
|
18
|
+
gsub(%r([[:space:]]*\Z), '')
|
19
|
+
end
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hurricane_trimar
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- masatoshi_moritsuka
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-06-19 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: '2.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
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: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
description: This gem provides methods for trimming spaces.
|
56
|
+
email:
|
57
|
+
- yakiyaki_ikayaki@yahoo.co.jp
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".travis.yml"
|
65
|
+
- Gemfile
|
66
|
+
- Gemfile.lock
|
67
|
+
- LICENSE.txt
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- bin/console
|
71
|
+
- bin/setup
|
72
|
+
- hurricane_trimar.gemspec
|
73
|
+
- lib/hurricane_trimar.rb
|
74
|
+
- lib/hurricane_trimar/version.rb
|
75
|
+
homepage: https://github.com/sanfrecce-osaka/hurricane_trimar
|
76
|
+
licenses:
|
77
|
+
- MIT
|
78
|
+
metadata:
|
79
|
+
homepage_uri: https://github.com/sanfrecce-osaka/hurricane_trimar
|
80
|
+
source_code_uri: https://github.com/sanfrecce-osaka/hurricane_trimar
|
81
|
+
post_install_message:
|
82
|
+
rdoc_options: []
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
requirements: []
|
96
|
+
rubygems_version: 3.0.3
|
97
|
+
signing_key:
|
98
|
+
specification_version: 4
|
99
|
+
summary: This gem trims spaces of posix character class.
|
100
|
+
test_files: []
|