keigo 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -3
- data/Gemfile.lock +3 -3
- data/README.rdoc +5 -9
- data/VERSION +1 -1
- data/keigo.gemspec +20 -20
- data/keigo.yml +31 -9
- data/lib/keigo.rb +6 -17
- data/spec/keigo_spec.rb +7 -21
- metadata +55 -61
data/Gemfile
CHANGED
@@ -6,9 +6,9 @@ source "http://rubygems.org"
|
|
6
6
|
# Add dependencies to develop your gem here.
|
7
7
|
# Include everything needed to run rake, tests, features, etc.
|
8
8
|
group :development do
|
9
|
-
gem "rspec", "
|
10
|
-
gem "bundler", "
|
11
|
-
gem "jeweler", "
|
9
|
+
gem "rspec", ">= 2.3.0"
|
10
|
+
gem "bundler", ">= 1.0.0"
|
11
|
+
gem "jeweler", ">= 1.6.4"
|
12
12
|
gem "rcov", ">= 0"
|
13
13
|
gem 'autotest'
|
14
14
|
end
|
data/Gemfile.lock
CHANGED
data/README.rdoc
CHANGED
@@ -1,9 +1,5 @@
|
|
1
1
|
= keigo
|
2
2
|
|
3
|
-
keigo translates Japanese to polite expressions.
|
4
|
-
|
5
|
-
== DESCRIPTION
|
6
|
-
|
7
3
|
keigo translates Japanese into polite expressions.
|
8
4
|
|
9
5
|
== INSTALL
|
@@ -14,14 +10,14 @@ keigo translates Japanese into polite expressions.
|
|
14
10
|
|
15
11
|
require 'keigo'
|
16
12
|
|
17
|
-
|
13
|
+
'Alice'.sama
|
18
14
|
# => 'Alice様'
|
19
15
|
|
20
|
-
|
21
|
-
# => '
|
16
|
+
'今日こいつが来る'.keigo
|
17
|
+
# => '本日こちらさまがおいでになる'
|
22
18
|
|
23
|
-
|
24
|
-
# => '
|
19
|
+
'あいつが今日から本を読む'.keigo
|
20
|
+
# => 'あちらさまが本日から本をお読みになる'
|
25
21
|
|
26
22
|
== Contributing to keigo
|
27
23
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.5
|
data/keigo.gemspec
CHANGED
@@ -4,14 +4,14 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "0.0.
|
7
|
+
s.name = "keigo"
|
8
|
+
s.version = "0.0.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = [
|
12
|
-
s.date =
|
13
|
-
s.description =
|
14
|
-
s.email =
|
11
|
+
s.authors = ["kano4"]
|
12
|
+
s.date = "2011-10-28"
|
13
|
+
s.description = "This is a polite expression gem."
|
14
|
+
s.email = "shinji@kano4.com"
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE.txt",
|
17
17
|
"README.rdoc"
|
@@ -32,32 +32,32 @@ Gem::Specification.new do |s|
|
|
32
32
|
"spec/keigo_spec.rb",
|
33
33
|
"spec/spec_helper.rb"
|
34
34
|
]
|
35
|
-
s.homepage =
|
36
|
-
s.licenses = [
|
37
|
-
s.require_paths = [
|
38
|
-
s.rubygems_version =
|
39
|
-
s.summary =
|
35
|
+
s.homepage = "http://github.com/kano4/keigo"
|
36
|
+
s.licenses = ["MIT"]
|
37
|
+
s.require_paths = ["lib"]
|
38
|
+
s.rubygems_version = "1.8.10"
|
39
|
+
s.summary = "polite expression"
|
40
40
|
|
41
41
|
if s.respond_to? :specification_version then
|
42
42
|
s.specification_version = 3
|
43
43
|
|
44
44
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
45
|
-
s.add_development_dependency(%q<rspec>, ["
|
46
|
-
s.add_development_dependency(%q<bundler>, ["
|
47
|
-
s.add_development_dependency(%q<jeweler>, ["
|
45
|
+
s.add_development_dependency(%q<rspec>, [">= 2.3.0"])
|
46
|
+
s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
|
47
|
+
s.add_development_dependency(%q<jeweler>, [">= 1.6.4"])
|
48
48
|
s.add_development_dependency(%q<rcov>, [">= 0"])
|
49
49
|
s.add_development_dependency(%q<autotest>, [">= 0"])
|
50
50
|
else
|
51
|
-
s.add_dependency(%q<rspec>, ["
|
52
|
-
s.add_dependency(%q<bundler>, ["
|
53
|
-
s.add_dependency(%q<jeweler>, ["
|
51
|
+
s.add_dependency(%q<rspec>, [">= 2.3.0"])
|
52
|
+
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
53
|
+
s.add_dependency(%q<jeweler>, [">= 1.6.4"])
|
54
54
|
s.add_dependency(%q<rcov>, [">= 0"])
|
55
55
|
s.add_dependency(%q<autotest>, [">= 0"])
|
56
56
|
end
|
57
57
|
else
|
58
|
-
s.add_dependency(%q<rspec>, ["
|
59
|
-
s.add_dependency(%q<bundler>, ["
|
60
|
-
s.add_dependency(%q<jeweler>, ["
|
58
|
+
s.add_dependency(%q<rspec>, [">= 2.3.0"])
|
59
|
+
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
60
|
+
s.add_dependency(%q<jeweler>, [">= 1.6.4"])
|
61
61
|
s.add_dependency(%q<rcov>, [">= 0"])
|
62
62
|
s.add_dependency(%q<autotest>, [">= 0"])
|
63
63
|
end
|
data/keigo.yml
CHANGED
@@ -12,25 +12,47 @@
|
|
12
12
|
今日 : 本日
|
13
13
|
|
14
14
|
# 動詞
|
15
|
-
言う : おっしゃる
|
16
15
|
思う : 思われる
|
17
16
|
書く : お書きになる
|
18
17
|
考える : お考えになる
|
19
|
-
見る : ご覧になる
|
20
|
-
聞く : お聞きになる
|
21
|
-
会う : お会いになる
|
22
|
-
行く : 行かれる
|
23
|
-
来る : おいでになる
|
24
|
-
尋ねる : お尋ねになる
|
25
18
|
与える : お与えになる
|
26
19
|
もらう : お受けになる
|
27
20
|
知る : お知りになる
|
28
|
-
食べる : お食べになる
|
29
|
-
着る : 着られる
|
30
21
|
読む : お読みになる
|
31
22
|
送る : お送りになる
|
32
23
|
贈る : お贈りになる
|
33
24
|
買う : お買いになる
|
34
25
|
飲む : 飲まれる
|
26
|
+
会う : お会いになる
|
27
|
+
与える : くださる
|
28
|
+
やる : くださる
|
29
|
+
集まる : お集まりになる
|
30
|
+
言う : おっしゃる
|
31
|
+
行く : お出かけになる
|
32
|
+
来る : お見えになる
|
33
|
+
いる : いらっしゃる
|
34
|
+
売る : お譲りになる
|
35
|
+
教える : お教えくださる
|
36
|
+
買う : お求めになる
|
37
|
+
借りる : お借りになる
|
38
|
+
帰る : お帰りになる
|
39
|
+
がんばる : お励みになる
|
40
|
+
聞く : お聞きになる
|
41
|
+
決める : お決めになる
|
42
|
+
着る : お召しになる
|
43
|
+
叱る : お叱りになる
|
44
|
+
死ぬ : お亡くなりになる
|
45
|
+
する : なさる
|
46
|
+
助ける : お力添え
|
47
|
+
尋ねる : お尋ねになる
|
48
|
+
食べる : 召し上がる
|
49
|
+
連れていく: お連れになる
|
50
|
+
眠る : お休みになる
|
51
|
+
寝る : お休みになる
|
52
|
+
見せる : お見せになる
|
53
|
+
見る : ご覧になる
|
54
|
+
ゆるす : お許しになる
|
55
|
+
わかる : おわかりになる
|
56
|
+
|
35
57
|
いる : いらっしゃる
|
36
58
|
する : される
|
data/lib/keigo.rb
CHANGED
@@ -2,25 +2,14 @@
|
|
2
2
|
require 'yaml'
|
3
3
|
$keigo_henkan = YAML.load_file(File.dirname(__FILE__) + '/../keigo.yml')
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
def k text
|
10
|
-
Keigo.new.k text
|
11
|
-
end
|
12
|
-
|
13
|
-
class Keigo
|
14
|
-
def initialize
|
15
|
-
@keigo_henkan = $keigo_henkan
|
16
|
-
end
|
17
|
-
|
18
|
-
def sama name
|
19
|
-
"#{name}様"
|
5
|
+
class String
|
6
|
+
def sama
|
7
|
+
"#{self}様"
|
20
8
|
end
|
21
9
|
|
22
|
-
def
|
23
|
-
|
10
|
+
def keigo
|
11
|
+
text = self
|
12
|
+
$keigo_henkan.each_key {|key| text = text.sub(key, $keigo_henkan[key])}
|
24
13
|
text
|
25
14
|
end
|
26
15
|
end
|
data/spec/keigo_spec.rb
CHANGED
@@ -3,33 +3,19 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
3
3
|
require 'yaml'
|
4
4
|
$keigo_henkan = YAML.load_file(File.dirname(__FILE__) + '/../keigo.yml')
|
5
5
|
|
6
|
-
describe
|
7
|
-
|
8
|
-
@keigo = Keigo.new
|
9
|
-
end
|
10
|
-
it 'は、keigo.samaを使うと最後に"様"が付加される' do
|
11
|
-
name = @keigo.sama('Keigo')
|
12
|
-
name.should == 'Keigo様'
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'は、sama関数を使うと最後に"様"が付加される' do
|
16
|
-
sama('Keigo').should be_eql 'Keigo様'
|
17
|
-
end
|
6
|
+
describe String do
|
7
|
+
it { "Alice".sama.should be_eql 'Alice様' }
|
18
8
|
|
19
9
|
context 'は、変換後に登録されていない場合' do
|
20
|
-
it {
|
21
|
-
it {
|
10
|
+
it { 'こんにちわ'.keigo.should be_eql 'こんにちわ' }
|
11
|
+
it { 'わたくし'.keigo.should be_eql 'わたくし' }
|
22
12
|
end
|
23
13
|
|
24
14
|
context 'は、変換語に登録されている場合' do
|
25
|
-
|
26
|
-
|
27
|
-
@keigo_henkan.each do |key, keigo|
|
28
|
-
it { k(key).should be_eql keigo }
|
15
|
+
$keigo_henkan.each do |key, keigo|
|
16
|
+
it { key.keigo.should be_eql keigo }
|
29
17
|
end
|
30
18
|
|
31
|
-
it {
|
32
|
-
|
33
|
-
it { @keigo.k('わたし').should be_eql 'わたくし' }
|
19
|
+
it { 'あいつが今日来る。'.keigo.should be_eql 'あちらさまが本日おいでになる。' }
|
34
20
|
end
|
35
21
|
end
|
metadata
CHANGED
@@ -1,82 +1,79 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: keigo
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.5
|
4
5
|
prerelease:
|
5
|
-
version: 0.0.3
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- kano4
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-10-28 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
16
15
|
name: rspec
|
17
|
-
requirement: &
|
16
|
+
requirement: &26873780 !ruby/object:Gem::Requirement
|
18
17
|
none: false
|
19
|
-
requirements:
|
20
|
-
- -
|
21
|
-
- !ruby/object:Gem::Version
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
22
21
|
version: 2.3.0
|
23
22
|
type: :development
|
24
23
|
prerelease: false
|
25
|
-
version_requirements: *
|
26
|
-
- !ruby/object:Gem::Dependency
|
24
|
+
version_requirements: *26873780
|
25
|
+
- !ruby/object:Gem::Dependency
|
27
26
|
name: bundler
|
28
|
-
requirement: &
|
27
|
+
requirement: &26873240 !ruby/object:Gem::Requirement
|
29
28
|
none: false
|
30
|
-
requirements:
|
31
|
-
- -
|
32
|
-
- !ruby/object:Gem::Version
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
33
32
|
version: 1.0.0
|
34
33
|
type: :development
|
35
34
|
prerelease: false
|
36
|
-
version_requirements: *
|
37
|
-
- !ruby/object:Gem::Dependency
|
35
|
+
version_requirements: *26873240
|
36
|
+
- !ruby/object:Gem::Dependency
|
38
37
|
name: jeweler
|
39
|
-
requirement: &
|
38
|
+
requirement: &26872620 !ruby/object:Gem::Requirement
|
40
39
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
44
43
|
version: 1.6.4
|
45
44
|
type: :development
|
46
45
|
prerelease: false
|
47
|
-
version_requirements: *
|
48
|
-
- !ruby/object:Gem::Dependency
|
46
|
+
version_requirements: *26872620
|
47
|
+
- !ruby/object:Gem::Dependency
|
49
48
|
name: rcov
|
50
|
-
requirement: &
|
49
|
+
requirement: &26872040 !ruby/object:Gem::Requirement
|
51
50
|
none: false
|
52
|
-
requirements:
|
53
|
-
- -
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version:
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
56
55
|
type: :development
|
57
56
|
prerelease: false
|
58
|
-
version_requirements: *
|
59
|
-
- !ruby/object:Gem::Dependency
|
57
|
+
version_requirements: *26872040
|
58
|
+
- !ruby/object:Gem::Dependency
|
60
59
|
name: autotest
|
61
|
-
requirement: &
|
60
|
+
requirement: &26871560 !ruby/object:Gem::Requirement
|
62
61
|
none: false
|
63
|
-
requirements:
|
64
|
-
- -
|
65
|
-
- !ruby/object:Gem::Version
|
66
|
-
version:
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
67
66
|
type: :development
|
68
67
|
prerelease: false
|
69
|
-
version_requirements: *
|
68
|
+
version_requirements: *26871560
|
70
69
|
description: This is a polite expression gem.
|
71
70
|
email: shinji@kano4.com
|
72
71
|
executables: []
|
73
|
-
|
74
72
|
extensions: []
|
75
|
-
|
76
|
-
extra_rdoc_files:
|
73
|
+
extra_rdoc_files:
|
77
74
|
- LICENSE.txt
|
78
75
|
- README.rdoc
|
79
|
-
files:
|
76
|
+
files:
|
80
77
|
- .autotest
|
81
78
|
- .document
|
82
79
|
- .rspec
|
@@ -92,34 +89,31 @@ files:
|
|
92
89
|
- spec/keigo_spec.rb
|
93
90
|
- spec/spec_helper.rb
|
94
91
|
homepage: http://github.com/kano4/keigo
|
95
|
-
licenses:
|
92
|
+
licenses:
|
96
93
|
- MIT
|
97
94
|
post_install_message:
|
98
95
|
rdoc_options: []
|
99
|
-
|
100
|
-
require_paths:
|
96
|
+
require_paths:
|
101
97
|
- lib
|
102
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
103
99
|
none: false
|
104
|
-
requirements:
|
105
|
-
- -
|
106
|
-
- !ruby/object:Gem::Version
|
107
|
-
|
108
|
-
segments:
|
100
|
+
requirements:
|
101
|
+
- - ! '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
segments:
|
109
105
|
- 0
|
110
|
-
|
111
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
+
hash: 656101100285914300
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
108
|
none: false
|
113
|
-
requirements:
|
114
|
-
- -
|
115
|
-
- !ruby/object:Gem::Version
|
116
|
-
version:
|
109
|
+
requirements:
|
110
|
+
- - ! '>='
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
117
113
|
requirements: []
|
118
|
-
|
119
114
|
rubyforge_project:
|
120
|
-
rubygems_version: 1.8.
|
115
|
+
rubygems_version: 1.8.10
|
121
116
|
signing_key:
|
122
117
|
specification_version: 3
|
123
118
|
summary: polite expression
|
124
119
|
test_files: []
|
125
|
-
|