pebbles-dajare 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +2 -1
- data/Gemfile +0 -7
- data/lib/pebbles/dajare.rb +4 -5
- data/lib/pebbles/dajare/version.rb +1 -1
- data/pebbles-dajare.gemspec +13 -14
- data/spec/pebbles/dajare_spec.rb +5 -5
- metadata +28 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 12e8fc82c52036f195326c07da4f93a6d41da81a2e5e1356b013c80739f39923
|
4
|
+
data.tar.gz: f4d4f775a1cae7373ce05fe99a00c9e42af6d0658fb53a1171a4c1fd65dfc8c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4c33118fa2ea27d4540e0f3b49eb66c9ab8d37ff24d3efac963243827d082ef137ecb108d832a70efc1cb271e1a566115e24dbe2e1e2ca847ea0043301c9a0d
|
7
|
+
data.tar.gz: 78358441cba72a732ec3fe24d17a61e7e28e8aa85c17f21a6764d91309ee60dfe62d911e1105784435d4c6346769903fcb030aec0e09b64bbeed5597ed0fe150
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/lib/pebbles/dajare.rb
CHANGED
@@ -1,13 +1,11 @@
|
|
1
1
|
require 'google_suggest'
|
2
|
-
require 'pebbles/dajare/version'
|
3
2
|
|
4
3
|
module Pebbles
|
5
4
|
module Dajare
|
6
|
-
|
7
5
|
def generate_dajare(phrase, degree: 2, region: 'jp')
|
8
6
|
components = phrase.scan(/./)
|
9
7
|
|
10
|
-
prefix = components[0..-(degree+1)].join
|
8
|
+
prefix = components[0..-(degree + 1)].join
|
11
9
|
src_dajare = components[-degree..-1].join
|
12
10
|
|
13
11
|
results = GoogleSuggest.suggest_for(src_dajare, region: region)
|
@@ -15,11 +13,12 @@ module Pebbles
|
|
15
13
|
dajares = results.map do |result|
|
16
14
|
prefix + result.split(' ').shift
|
17
15
|
end
|
18
|
-
|
16
|
+
|
17
|
+
dajares
|
19
18
|
end
|
20
19
|
|
21
20
|
def dajarize(degree: 2, region: 'jp')
|
22
|
-
Pebbles::Dajare.generate_dajare(
|
21
|
+
Pebbles::Dajare.generate_dajare(to_s, degree: degree, region: region)
|
23
22
|
end
|
24
23
|
|
25
24
|
module_function :generate_dajare
|
data/pebbles-dajare.gemspec
CHANGED
@@ -1,26 +1,25 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require "pebbles/dajare/version"
|
1
|
+
$LOAD_PATH.push File.expand_path(File.join(__dir__, 'lib'))
|
2
|
+
require 'pebbles/dajare/version'
|
4
3
|
|
5
4
|
Gem::Specification.new do |s|
|
6
|
-
s.name =
|
5
|
+
s.name = 'pebbles-dajare'
|
7
6
|
s.version = Pebbles::Dajare::VERSION
|
8
|
-
s.authors = [
|
9
|
-
s.email = [
|
10
|
-
s.homepage =
|
11
|
-
s.summary =
|
7
|
+
s.authors = ['Tatsuya Sato']
|
8
|
+
s.email = ['satoryu.1981@gmail.com']
|
9
|
+
s.homepage = 'https://github.com/satoryu/pebbles-dajare'
|
10
|
+
s.summary = 'a gem to generate dajare'
|
12
11
|
s.description = <<-DESC
|
13
12
|
DESC
|
14
13
|
|
15
|
-
s.rubyforge_project =
|
16
|
-
s.required_ruby_version = '>= 2.
|
14
|
+
s.rubyforge_project = 'pebbles-dajare'
|
15
|
+
s.required_ruby_version = '>= 2.2'
|
17
16
|
|
18
17
|
s.files = `git ls-files`.split("\n")
|
19
18
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
20
|
-
s.
|
21
|
-
s.require_paths = ["lib"]
|
19
|
+
s.require_paths = ['lib']
|
22
20
|
|
23
21
|
# specify any dependencies here; for example:
|
24
|
-
s.
|
25
|
-
s.
|
22
|
+
s.add_runtime_dependency 'google_suggest', '~> 1.0.0'
|
23
|
+
s.add_development_dependency 'rake', '~> 11.2.2'
|
24
|
+
s.add_development_dependency 'rspec', '~> 3.5.0'
|
26
25
|
end
|
data/spec/pebbles/dajare_spec.rb
CHANGED
@@ -5,7 +5,7 @@ describe Pebbles::Dajare do
|
|
5
5
|
let(:keyword) { 'ます' }
|
6
6
|
|
7
7
|
before do
|
8
|
-
GoogleSuggest.
|
8
|
+
allow(GoogleSuggest).to receive(:suggest_for).with(keyword, options).and_return([
|
9
9
|
'舛添要一'
|
10
10
|
])
|
11
11
|
end
|
@@ -13,27 +13,27 @@ describe Pebbles::Dajare do
|
|
13
13
|
describe ".generate_dajare" do
|
14
14
|
subject { Pebbles::Dajare.generate_dajare 'ありがとうございます' }
|
15
15
|
|
16
|
-
|
16
|
+
it { is_expected.to match_array(%w[ありがとうござい舛添要一]) }
|
17
17
|
|
18
18
|
context 'Giving degree option' do
|
19
19
|
let(:keyword) { 'います' }
|
20
20
|
|
21
21
|
subject { Pebbles::Dajare.generate_dajare('ありがとうございます', degree: 3) }
|
22
22
|
|
23
|
-
|
23
|
+
it { is_expected.to match_array(%w[ありがとうござ舛添要一]) }
|
24
24
|
end
|
25
25
|
context 'Giving region option' do
|
26
26
|
let(:options) { { region: 'us' } }
|
27
27
|
|
28
28
|
subject { Pebbles::Dajare.generate_dajare('ありがとうございます', region: 'us') }
|
29
29
|
|
30
|
-
|
30
|
+
it { is_expected.to match_array(%w[ありがとうござい舛添要一]) }
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
34
|
describe "String#dajarize" do
|
35
35
|
subject { 'ありがとうございます'.dajarize }
|
36
36
|
|
37
|
-
|
37
|
+
it { is_expected.to match_array(%w[ありがとうござい舛添要一]) }
|
38
38
|
end
|
39
39
|
end
|
metadata
CHANGED
@@ -1,43 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pebbles-dajare
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tatsuya Sato
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: google_suggest
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
18
25
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
26
|
+
version: 1.0.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: 11.2.2
|
20
34
|
type: :development
|
21
35
|
prerelease: false
|
22
36
|
version_requirements: !ruby/object:Gem::Requirement
|
23
37
|
requirements:
|
24
|
-
- - "
|
38
|
+
- - "~>"
|
25
39
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
40
|
+
version: 11.2.2
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
42
|
+
name: rspec
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
45
|
- - "~>"
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
34
|
-
type: :
|
47
|
+
version: 3.5.0
|
48
|
+
type: :development
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
52
|
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
54
|
+
version: 3.5.0
|
41
55
|
description: ''
|
42
56
|
email:
|
43
57
|
- satoryu.1981@gmail.com
|
@@ -56,7 +70,7 @@ files:
|
|
56
70
|
- pebbles-dajare.gemspec
|
57
71
|
- spec/pebbles/dajare_spec.rb
|
58
72
|
- spec/spec_helper.rb
|
59
|
-
homepage:
|
73
|
+
homepage: https://github.com/satoryu/pebbles-dajare
|
60
74
|
licenses: []
|
61
75
|
metadata: {}
|
62
76
|
post_install_message:
|
@@ -67,7 +81,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
67
81
|
requirements:
|
68
82
|
- - ">="
|
69
83
|
- !ruby/object:Gem::Version
|
70
|
-
version: '2.
|
84
|
+
version: '2.2'
|
71
85
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
87
|
- - ">="
|
@@ -75,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
89
|
version: '0'
|
76
90
|
requirements: []
|
77
91
|
rubyforge_project: pebbles-dajare
|
78
|
-
rubygems_version: 2.
|
92
|
+
rubygems_version: 2.7.3
|
79
93
|
signing_key:
|
80
94
|
specification_version: 4
|
81
95
|
summary: a gem to generate dajare
|