itaiji 0.1.6 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 332ee8ad779143a7b353ede9d24fb0fe755b02b7
4
- data.tar.gz: b4d77c92af003f3f51064ea4f15faa9bdd0660db
3
+ metadata.gz: fb7b98f8cab19bf34ec0857818d09f7f28ebfe60
4
+ data.tar.gz: 0b089c165933b9de95cbe98cca6592132acf4d67
5
5
  SHA512:
6
- metadata.gz: e65f9d789df4e777b98259646fae387df5445f48d2eade75a7051d8699c7ef07b607e96919972210cd0a4d13650c0c733784d91b0804a8762386a2a75f042f14
7
- data.tar.gz: 66b6bfde75f37e45fa3e8b710fe3546c7edc7210076e207db8887ada965ddfaaf67533439e415b95ea932d88a93174ecd0088f10cdcef9be45c11a10a1b19aea
6
+ metadata.gz: c876d445bedd425f02b9d4f0ec023f5e430881e09c3a774dcbb448785e71f159af9979a9518e2977f6c138270143d42c7ce05f0a3c3d58790c95a3eaff3cef7d
7
+ data.tar.gz: c31d184cadada3926758cdc60e0d6bc6e539cad163310b2391aa4135285304b481db398d4a820b8071b29cc32eee4e16970534013cc14820420be919c03a2e2e
data/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
  [![Dependency Status](https://gemnasium.com/camelmasa/itaiji.svg)](https://gemnasium.com/camelmasa/itaiji)
7
7
 
8
8
 
9
- Convert japanese itaiji(異体字) to seijitai(正字体) and also reverse convert.
9
+ Convert japanese itaiji(異体字) to seijitai(正字体).
10
10
  Instration
11
11
  ----------
12
12
 
@@ -28,8 +28,8 @@ Usage
28
28
  ```
29
29
  converter = Itaiji::Converter.new
30
30
 
31
- converter.convert_seijitai('齊藤') # => '斉藤'
32
- converter.convert_itaiji('斉藤') # => '齊藤'
31
+ converter.seijitai('齊藤') # => '斉藤'
32
+ converter.itaiji('斉藤') # => '齊藤'
33
33
  ```
34
34
 
35
35
  or
@@ -1,6 +1,6 @@
1
1
  module Itaiji
2
2
  class Converter
3
- def convert_seijitai(string)
3
+ def seijitai(string)
4
4
  itaiji_list.inject(string) do |string, itaiji_set|
5
5
  seijitai = itaiji_set.keys.first
6
6
  itaijis = itaiji_set.values.first
@@ -9,7 +9,11 @@ module Itaiji
9
9
  end
10
10
  end
11
11
 
12
- def convert_itaiji(string)
12
+ def convert_seijitai(string)
13
+ seijitai(string)
14
+ end
15
+
16
+ def itaiji(string)
13
17
  itaiji_list.inject(string) do |string, itaiji_set|
14
18
  seijitai = itaiji_set.keys.first
15
19
  itaiji = itaiji_set.values.flatten.first
@@ -18,6 +22,14 @@ module Itaiji
18
22
  end
19
23
  end
20
24
 
25
+ def convert_itaiji(string)
26
+ itaiji(string)
27
+ end
28
+
29
+ extend Gem::Deprecate
30
+ deprecate :convert_seijitai, :seijitai, 2018, 1
31
+ deprecate :convert_itaiji, :itaiji, 2018, 1
32
+
21
33
  private
22
34
 
23
35
  def itaiji_list
@@ -2,11 +2,11 @@ module Itaiji
2
2
  module Conversions
3
3
  refine String do
4
4
  def to_seijitai
5
- itaiji_converter.convert_seijitai(self)
5
+ itaiji_converter.seijitai(self)
6
6
  end
7
7
 
8
8
  def to_itaiji
9
- itaiji_converter.convert_itaiji(self)
9
+ itaiji_converter.itaiji(self)
10
10
  end
11
11
 
12
12
  private
@@ -1,3 +1,3 @@
1
1
  module Itaiji
2
- VERSION = "0.1.6"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -1,16 +1,28 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Itaiji::Converter do
4
-
5
4
  let(:itaiji) { '齊藤正澔' }
6
5
  let(:seijitai) { '斉藤正浩' }
7
6
  let(:converter) { Itaiji::Converter.new }
8
7
 
8
+ describe '#seijitai' do
9
+ it 'converts name from itaiji to seijitai' do
10
+ expect(converter.seijitai(itaiji)).to eq seijitai
11
+ end
12
+ end
13
+
14
+ describe '#itaiji' do
15
+ it 'converts name from seijitai to itaiji' do
16
+ expect(converter.itaiji(seijitai)).to eq itaiji
17
+ end
18
+ end
19
+
9
20
  describe '#convert_seijitai' do
10
21
  it 'converts name from itaiji to seijitai' do
11
22
  expect(converter.convert_seijitai(itaiji)).to eq seijitai
12
23
  end
13
24
  end
25
+
14
26
  describe '#convert_itaiji' do
15
27
  it 'converts name from seijitai to itaiji' do
16
28
  expect(converter.convert_itaiji(seijitai)).to eq itaiji
@@ -2,7 +2,6 @@ require 'spec_helper'
2
2
  using Itaiji::Conversions
3
3
 
4
4
  describe Itaiji::Conversions do
5
-
6
5
  let(:itaiji) { '齊藤正澔' }
7
6
  let(:seijitai) { '斉藤正浩' }
8
7
  let(:converter) { Itaiji::Converter.new }
@@ -12,6 +11,7 @@ describe Itaiji::Conversions do
12
11
  expect(itaiji.to_seijitai).to eq seijitai
13
12
  end
14
13
  end
14
+
15
15
  describe '#convert_itaiji' do
16
16
  it 'converts name from seijitai to itaiji' do
17
17
  expect(seijitai.to_itaiji).to eq itaiji
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itaiji
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masahiro Saito