unified_hyphen 0.0.1 → 0.0.2
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 +4 -4
- data/bin/rspec +16 -0
- data/lib/unified_hyphen.rb +5 -6
- data/lib/unified_hyphen/version.rb +1 -1
- data/spec/unified_hyphen_spec.rb +20 -3
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97bab0130a131792abb21be1f263d70e57d457b8
|
4
|
+
data.tar.gz: 7505ded29185b7dfd282f8a23a66c6918a0b970c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55bbefb76c24c4ebdfa084041137fa546db854343e2e74436c5b14d73403199ea91189e23055da89a5b7559fb4ddc6eb320026a55d23591ba87fd43e5161c234
|
7
|
+
data.tar.gz: 56e9850b68491273bad9786c21703b0ed3c3914408ce9ae8dd64933c812463a1e529b9555db6390a4cbd2e66f85d515a9ffabb75ed21fb31ceea24cb3fbdc936
|
data/bin/rspec
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'rspec' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require "pathname"
|
10
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require "rubygems"
|
14
|
+
require "bundler/setup"
|
15
|
+
|
16
|
+
load Gem.bin_path("rspec-core", "rspec")
|
data/lib/unified_hyphen.rb
CHANGED
@@ -2,13 +2,12 @@ require "unified_hyphen/version"
|
|
2
2
|
module UnifiedHyphen
|
3
3
|
end
|
4
4
|
class String
|
5
|
-
|
6
|
-
|
7
|
-
self.gsub(
|
5
|
+
JA_HYPEN_PATTERN = /ー|−|―|-|‐|‑|–|—|ー/
|
6
|
+
def unify_ja_hyphen(dst_string="-")
|
7
|
+
self.gsub(JA_HYPEN_PATTERN, dst_string)
|
8
8
|
end
|
9
9
|
|
10
|
-
def
|
11
|
-
|
12
|
-
self.gsub!(/#{hyphen}/, to_hyphen)
|
10
|
+
def unify_ja_hyphen!(dst_string="-")
|
11
|
+
self.gsub!(JA_HYPEN_PATTERN, dst_string)
|
13
12
|
end
|
14
13
|
end
|
data/spec/unified_hyphen_spec.rb
CHANGED
@@ -1,12 +1,29 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
+
RSpec.shared_examples "correct unified hyphen" do |parameter|
|
4
|
+
it {
|
5
|
+
expect(str_fixed).to eq str_org.send(parameter)
|
6
|
+
}
|
7
|
+
end
|
8
|
+
|
3
9
|
describe UnifiedHyphen do
|
4
10
|
it 'has a version number' do
|
5
11
|
expect(UnifiedHyphen::VERSION).not_to be nil
|
6
12
|
end
|
7
13
|
|
8
|
-
|
9
|
-
|
10
|
-
|
14
|
+
let(:str_org) { "ー:−:―:-:‐:‑:–:—:ー" }
|
15
|
+
let(:str_fixed) { "-:-:-:-:-:-:-:-:-" }
|
16
|
+
|
17
|
+
include_examples "correct unified hyphen", :unify_ja_hyphen
|
18
|
+
include_examples "correct unified hyphen", :unify_ja_hyphen!
|
19
|
+
|
20
|
+
it 'unify_ja_hyphen is not bang method' do
|
21
|
+
str_org.unify_ja_hyphen
|
22
|
+
expect(str_org).to eq str_org
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'unify_ja_hyphen! is bang method' do
|
26
|
+
str_org.unify_ja_hyphen!
|
27
|
+
expect(str_fixed).to eq str_org
|
11
28
|
end
|
12
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unified_hyphen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yoshiki Kobayashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -55,7 +55,8 @@ dependencies:
|
|
55
55
|
description: unified hyphen
|
56
56
|
email:
|
57
57
|
- attack_no22001@yahoo.co.jp
|
58
|
-
executables:
|
58
|
+
executables:
|
59
|
+
- rspec
|
59
60
|
extensions: []
|
60
61
|
extra_rdoc_files: []
|
61
62
|
files:
|
@@ -66,6 +67,7 @@ files:
|
|
66
67
|
- LICENSE.txt
|
67
68
|
- README.md
|
68
69
|
- Rakefile
|
70
|
+
- bin/rspec
|
69
71
|
- lib/unified_hyphen.rb
|
70
72
|
- lib/unified_hyphen/version.rb
|
71
73
|
- spec/spec_helper.rb
|