pebbles-dajare 0.0.1

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.
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ *.swp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
@@ -0,0 +1,6 @@
1
+ rvm:
2
+ - 1.9.2
3
+ branches:
4
+ only:
5
+ - master
6
+ - develop
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'google_suggest'
4
+
5
+ group :development, :test do
6
+ gem 'rake'
7
+ gem 'rspec', '~> 2.8.0'
8
+ end
9
+
10
+ # Specify your gem's dependencies in pebbles-dajare.gemspec
11
+ gemspec
@@ -0,0 +1,42 @@
1
+ = What's This ?
2
+ Dajare means pun in Japanese.
3
+ This gem allows developers to generate puns.
4
+
5
+ = Installation
6
+ gem install pebbles-dajare
7
+
8
+ = Usage
9
+ require 'pebbles/dajare'
10
+
11
+ Pebbles::Dajare.generate_dajare 'ありがとうございます。' #=> 'ありがとうござい益若つばさ。'
12
+
13
+ 'ありがとうございます。'.dajarize #=> 'ありがとうござい益若つばさ。'
14
+
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]
18
+
19
+
20
+ = LICENSE
21
+
22
+ The MIT License
23
+
24
+ Copyright (c) 2012 Tatsuya Sato
25
+
26
+ Permission is hereby granted, free of charge, to any person obtaining a copy
27
+ of this software and associated documentation files (the "Software"), to deal
28
+ in the Software without restriction, including without limitation the rights
29
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
30
+ copies of the Software, and to permit persons to whom the Software is
31
+ furnished to do so, subject to the following conditions:
32
+
33
+ The above copyright notice and this permission notice shall be included in
34
+ all copies or substantial portions of the Software.
35
+
36
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
37
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
38
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
39
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
40
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
41
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
42
+ THE SOFTWARE.
@@ -0,0 +1,9 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new do |t|
5
+ t.pattern = 'spec/**/*_spec.rb'
6
+ t.rspec_opts = '-c -fd'
7
+ end
8
+
9
+ task :default => :spec
@@ -0,0 +1,23 @@
1
+ require 'google_suggest'
2
+
3
+ module Pebbles
4
+ module Dajare
5
+ VERSION = '0.0.1'
6
+
7
+ def generate_dajare(phrase, degree=2)
8
+ components = phrase.scan(/./)
9
+
10
+ prefix = components[0..-(degree+1)].join
11
+ src_dajare = components[-degree..-1].join
12
+
13
+ results = GoogleSuggest.suggest_for(src_dajare)
14
+
15
+ dajares = results.map do |result|
16
+ prefix + result['suggestion'].split(' ').shift
17
+ end
18
+ return dajares
19
+ end
20
+
21
+ module_function :generate_dajare
22
+ end
23
+ end
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "pebbles/dajare"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "pebbles-dajare"
7
+ s.version = Pebbles::Dajare::VERSION
8
+ s.authors = ["Tatsuya Sato"]
9
+ s.email = ["satoryu.1981@gmail.com"]
10
+ s.homepage = "http://github.com/satoryu/pebbles-dajare"
11
+ s.summary = %q{a gem to generate dajare}
12
+ s.description = <<-DESC
13
+ DESC
14
+
15
+ s.rubyforge_project = "pebbles-dajare"
16
+ s.required_ruby_version = '>= 1.9.2'
17
+
18
+ s.files = `git ls-files`.split("\n")
19
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
20
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
+ s.require_paths = ["lib"]
22
+
23
+ # specify any dependencies here; for example:
24
+ s.add_development_dependency "rspec", '>= 2'
25
+ s.add_runtime_dependency "google_suggest"
26
+ end
@@ -0,0 +1,14 @@
1
+ # encoding: utf-8
2
+ require 'pebbles/dajare'
3
+
4
+ describe Pebbles::Dajare do
5
+ before do
6
+ GoogleSuggest.stub(:suggest_for).with('ます').and_return([
7
+ {'suggestion' => '益若つばさ'}
8
+ ])
9
+ end
10
+
11
+ subject { Pebbles::Dajare.generate_dajare 'ありがとうございます' }
12
+ its(:shift) { should == 'ありがとうござい益若つばさ' }
13
+
14
+ end
@@ -0,0 +1,14 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # Require this file using `require "spec_helper.rb"` to ensure that it is only
4
+ # loaded once.
5
+ #
6
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
+ $: << File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
8
+
9
+ RSpec.configure do |config|
10
+ config.treat_symbols_as_metadata_keys_with_true_values = true
11
+ config.run_all_when_everything_filtered = true
12
+ config.filter_run :focus
13
+ config.mock_with :rspec
14
+ end
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pebbles-dajare
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Tatsuya Sato
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-01-17 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: &692660 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '2'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *692660
25
+ - !ruby/object:Gem::Dependency
26
+ name: google_suggest
27
+ requirement: &692270 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *692270
36
+ description: ''
37
+ email:
38
+ - satoryu.1981@gmail.com
39
+ executables: []
40
+ extensions: []
41
+ extra_rdoc_files: []
42
+ files:
43
+ - .gitignore
44
+ - .rspec
45
+ - .travis.yml
46
+ - Gemfile
47
+ - README.rdoc
48
+ - Rakefile
49
+ - lib/pebbles/dajare.rb
50
+ - pebbles-dajare.gemspec
51
+ - spec/pebbles/dajare_spec.rb
52
+ - spec/spec_helper.rb
53
+ homepage: http://github.com/satoryu/pebbles-dajare
54
+ licenses: []
55
+ post_install_message:
56
+ rdoc_options: []
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: 1.9.2
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ requirements: []
72
+ rubyforge_project: pebbles-dajare
73
+ rubygems_version: 1.8.10
74
+ signing_key:
75
+ specification_version: 3
76
+ summary: a gem to generate dajare
77
+ test_files:
78
+ - spec/pebbles/dajare_spec.rb
79
+ - spec/spec_helper.rb