pebbles-dajare 0.1.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7a97c562df8f3fd2747182b3b88377f8dce62721
4
+ data.tar.gz: 495dae493577a5cef74ce24248455887d5562e95
5
+ SHA512:
6
+ metadata.gz: f0502d3a8d13170b269c2867e748ebab91060edbe252ac182b38cc4b4599899d2139d6d4a6e2811916ee123e1107ba147726b2d6fc2b58d0c676e5acdad7aac5
7
+ data.tar.gz: 7ebeccdb47c80334eb22f6010cbd1189c1aa747e7befcacbe54ee6bca7eaae82e1ba3053745580455f50926e75ceea7380a4385ac14e5593c8aadd41674876f2
@@ -1,6 +1,16 @@
1
+ language: ruby
2
+
1
3
  rvm:
2
- - 1.9.2
3
- branches:
4
- only:
5
- - master
6
- - develop
4
+ - 2.1.9
5
+ - 2.2.5
6
+ - 2.3.1
7
+ - ruby-head
8
+
9
+ cache: bundler
10
+
11
+ before_install:
12
+ - gem install bundler
13
+
14
+ matrix:
15
+ allow_failures:
16
+ - rvm: ruby-head
@@ -1,21 +1,36 @@
1
- = What's This ?
1
+ = Pebbles::Dajare
2
+
3
+ {<img src="https://secure.travis-ci.org/satoryu/pebbles-dajare.png" />}[http://travis-ci.org/satoryu/pebbles-dajare]
4
+ {<img alt='Click here to lend your support to: pebbles-dajare and make a donation at www.pledgie.com !' src='http://www.pledgie.com/campaigns/16591.png?skin_name=chrome' border='0' />}[http://www.pledgie.com/campaigns/16591]
5
+
2
6
  Dajare means pun in Japanese.
3
7
  This gem allows developers to generate puns.
4
8
 
5
9
  = Installation
6
- gem install pebbles-dajare
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ gem 'pebbles-dajare'
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install pebbles-dajare
7
22
 
8
23
  = Usage
9
24
  require 'pebbles/dajare'
10
25
 
11
- Pebbles::Dajare.generate_dajare 'ありがとうございます。' #=> 'ありがとうござい益若つばさ。'
26
+ Pebbles::Dajare.generate_dajare 'ありがとうございます' #=> 'ありがとうござい舛添要一'
12
27
 
13
- 'ありがとうございます。'.dajarize #=> 'ありがとうござい益若つばさ。'
28
+ 'ありがとうございます'.dajarize #=> 'ありがとうござい舛添要一'
14
29
 
15
- = Current Status by Travis CI
16
-
17
- {<img src="https://secure.travis-ci.org/satoryu/pebbles-dajare.png" />}[http://travis-ci.org/satoryu/pebbles-dajare]
30
+ == Options
18
31
 
32
+ [+degree+] The length of suffix of a given phrase used as an argument of +GoogleSuggest.suggest_for+
33
+ [+region+] The region of the endpoint of Google Suggest API
19
34
 
20
35
  = LICENSE
21
36
 
@@ -4,22 +4,22 @@ require 'pebbles/dajare/version'
4
4
  module Pebbles
5
5
  module Dajare
6
6
 
7
- def generate_dajare(phrase, degree=2)
7
+ def generate_dajare(phrase, degree: 2, region: 'jp')
8
8
  components = phrase.scan(/./)
9
9
 
10
10
  prefix = components[0..-(degree+1)].join
11
11
  src_dajare = components[-degree..-1].join
12
12
 
13
- results = GoogleSuggest.suggest_for(src_dajare)
13
+ results = GoogleSuggest.suggest_for(src_dajare, region: region)
14
14
 
15
15
  dajares = results.map do |result|
16
- prefix + result['suggestion'].split(' ').shift
16
+ prefix + result.split(' ').shift
17
17
  end
18
18
  return dajares
19
19
  end
20
20
 
21
- def dajarize(degree=2)
22
- Pebbles::Dajare.generate_dajare(self.to_s, degree)
21
+ def dajarize(degree: 2, region: 'jp')
22
+ Pebbles::Dajare.generate_dajare(self.to_s, degree: degree, region: region)
23
23
  end
24
24
 
25
25
  module_function :generate_dajare
@@ -1,5 +1,5 @@
1
1
  module Pebbles
2
2
  module Dajare
3
- VERSION = '0.1.0'
3
+ VERSION = '1.0.0'
4
4
  end
5
5
  end
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
13
13
  DESC
14
14
 
15
15
  s.rubyforge_project = "pebbles-dajare"
16
- s.required_ruby_version = '>= 1.9.2'
16
+ s.required_ruby_version = '>= 2.1'
17
17
 
18
18
  s.files = `git ls-files`.split("\n")
19
19
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -22,5 +22,5 @@ Gem::Specification.new do |s|
22
22
 
23
23
  # specify any dependencies here; for example:
24
24
  s.add_development_dependency "rspec", '>= 2'
25
- s.add_runtime_dependency "google_suggest"
25
+ s.add_runtime_dependency "google_suggest", '~> 1.0.0'
26
26
  end
@@ -1,19 +1,39 @@
1
- # encoding: utf-8
2
1
  require 'pebbles/dajare'
3
2
 
4
3
  describe Pebbles::Dajare do
4
+ let(:options) { { region: 'jp' } }
5
+ let(:keyword) { 'ます' }
6
+
5
7
  before do
6
- GoogleSuggest.stub(:suggest_for).with('ます').and_return([
7
- {'suggestion' => '益若つばさ'}
8
+ GoogleSuggest.stub(:suggest_for).with(keyword, options).and_return([
9
+ '舛添要一'
8
10
  ])
9
11
  end
10
- context ".generate_dajare" do
12
+
13
+ describe ".generate_dajare" do
11
14
  subject { Pebbles::Dajare.generate_dajare 'ありがとうございます' }
12
- its(:shift) { should == 'ありがとうござい益若つばさ' }
15
+
16
+ its(:shift) { should == 'ありがとうござい舛添要一' }
17
+
18
+ context 'Giving degree option' do
19
+ let(:keyword) { 'います' }
20
+
21
+ subject { Pebbles::Dajare.generate_dajare('ありがとうございます', degree: 3) }
22
+
23
+ its(:shift) { should == 'ありがとうござ舛添要一' }
24
+ end
25
+ context 'Giving region option' do
26
+ let(:options) { { region: 'us' } }
27
+
28
+ subject { Pebbles::Dajare.generate_dajare('ありがとうございます', region: 'us') }
29
+
30
+ its(:shift) { should == 'ありがとうござい舛添要一' }
31
+ end
13
32
  end
14
- context "String#dajarize" do
33
+
34
+ describe "String#dajarize" do
15
35
  subject { 'ありがとうございます'.dajarize }
16
- its(:shift) { should == 'ありがとうござい益若つばさ' }
17
- end
18
36
 
37
+ its(:shift) { should == 'ありがとうござい舛添要一' }
38
+ end
19
39
  end
metadata CHANGED
@@ -1,38 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pebbles-dajare
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
5
- prerelease:
4
+ version: 1.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Tatsuya Sato
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-01-17 00:00:00.000000000Z
11
+ date: 2016-06-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec
16
- requirement: &3714120 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '2'
22
20
  type: :development
23
21
  prerelease: false
24
- version_requirements: *3714120
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '2'
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: google_suggest
27
- requirement: &3713870 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
- - - ! '>='
31
+ - - "~>"
31
32
  - !ruby/object:Gem::Version
32
- version: '0'
33
+ version: 1.0.0
33
34
  type: :runtime
34
35
  prerelease: false
35
- version_requirements: *3713870
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 1.0.0
36
41
  description: ''
37
42
  email:
38
43
  - satoryu.1981@gmail.com
@@ -40,9 +45,9 @@ executables: []
40
45
  extensions: []
41
46
  extra_rdoc_files: []
42
47
  files:
43
- - .gitignore
44
- - .rspec
45
- - .travis.yml
48
+ - ".gitignore"
49
+ - ".rspec"
50
+ - ".travis.yml"
46
51
  - Gemfile
47
52
  - README.rdoc
48
53
  - Rakefile
@@ -53,27 +58,26 @@ files:
53
58
  - spec/spec_helper.rb
54
59
  homepage: http://github.com/satoryu/pebbles-dajare
55
60
  licenses: []
61
+ metadata: {}
56
62
  post_install_message:
57
63
  rdoc_options: []
58
64
  require_paths:
59
65
  - lib
60
66
  required_ruby_version: !ruby/object:Gem::Requirement
61
- none: false
62
67
  requirements:
63
- - - ! '>='
68
+ - - ">="
64
69
  - !ruby/object:Gem::Version
65
- version: 1.9.2
70
+ version: '2.1'
66
71
  required_rubygems_version: !ruby/object:Gem::Requirement
67
- none: false
68
72
  requirements:
69
- - - ! '>='
73
+ - - ">="
70
74
  - !ruby/object:Gem::Version
71
75
  version: '0'
72
76
  requirements: []
73
77
  rubyforge_project: pebbles-dajare
74
- rubygems_version: 1.8.10
78
+ rubygems_version: 2.4.5.1
75
79
  signing_key:
76
- specification_version: 3
80
+ specification_version: 4
77
81
  summary: a gem to generate dajare
78
82
  test_files:
79
83
  - spec/pebbles/dajare_spec.rb