to_gal 0.0.2 → 1.0.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: bff3bf8eab5468bb62eb9969eb686b0745737ad1
4
- data.tar.gz: 2a6f5fe6a91d3c3826c09639138e25767e1b3259
3
+ metadata.gz: 0794cf7778cbef1b2857c999b12531e2594dabd3
4
+ data.tar.gz: aee99a8d2f433742658db28007f9627dbc945ef9
5
5
  SHA512:
6
- metadata.gz: 23babc3af5ef80c05881e072b8b3b9e866b31ae005b3ae44ca794b3c04051fcfbd116ba610462cb080dc8beab6fae48669005a763903223ba209d6987cbe2084
7
- data.tar.gz: 1df7ec6902a0a1a1e5a2a1ebac5113cf322652470c0b44406aeeb475bd5d5b5dd571217a594f43ea3d42954006808b55ccdcd8119f2483e1322dba103a427b43
6
+ metadata.gz: 86755784cab66ca0b152e5169c2c31df873c1a440e9427b1c6f02f2bcf39b7812ec65603c683724ba9ff19bb653af45db9e836f8d8a45320536ed02a2dad8fe0
7
+ data.tar.gz: 214cf9d35a36d67c7cd71ae7b96f6650e7cddd7e0308bd14c8d6df9439ae3d442b7df7ebb3ed9c2811fe31bd8a2d63cc944aa97cb16669fb497b7135bd6a8ad2
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ vendor/bundle
@@ -2,6 +2,7 @@ language: ruby
2
2
  rvm:
3
3
  - 2.0.0
4
4
  - 2.1.1
5
+ - 2.1.2
5
6
  script: bundle exec rspec
6
7
  notifications:
7
8
  on_success: always
data/Gemfile CHANGED
@@ -1,3 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
+ group :test do
5
+ gem 'coveralls', require: false
6
+ end
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # String#to_gal
2
2
 
3
- [![Build Status](https://travis-ci.org/onigra/to_gal.svg?branch=master)](https://travis-ci.org/onigra/to_gal)
3
+ [![Build Status](https://travis-ci.org/onigra/to_gal.svg?branch=master)](https://travis-ci.org/onigra/to_gal) [![Coverage Status](https://coveralls.io/repos/onigra/to_gal/badge.png)](https://coveralls.io/r/onigra/to_gal) [![Code Climate](https://codeclimate.com/github/onigra/to_gal.png)](https://codeclimate.com/github/onigra/to_gal)
4
4
 
5
5
  ## Installation
6
6
 
@@ -0,0 +1,12 @@
1
+ あ: ぁ
2
+ い: ぃ
3
+ う: ぅ
4
+ え: ぇ
5
+ お: ぉ
6
+ や: ゃ
7
+ ゆ: ゅ
8
+ よ: ょ
9
+ わ: ゎ
10
+ つ: っ
11
+ は: ゎ
12
+ 。: o
@@ -1,2 +1,6 @@
1
+ require "yaml" unless defined?(YAML)
2
+
1
3
  require "to_gal/version"
4
+ require "to_gal/dictionary"
2
5
  require "to_gal/extention/string"
6
+
@@ -0,0 +1,10 @@
1
+ # encoding: UTF-8
2
+
3
+ module ToGal
4
+ module Dictionary
5
+ BASE = YAML.load_file(File.expand_path("../../../data/dictionary.yml", __FILE__))
6
+ TR_ARGS = BASE.to_a.transpose.map(&:join)
7
+ end
8
+ end
9
+
10
+
@@ -1,24 +1,5 @@
1
1
  class String
2
2
  def to_gal
3
- dic = {
4
- 'あ' => 'ぁ',
5
- 'い' => 'ぃ',
6
- 'う' => 'ぅ',
7
- 'え' => 'ぇ',
8
- 'お' => 'ぉ',
9
- 'や' => 'ゃ',
10
- 'ゆ' => 'ゅ',
11
- 'よ' => 'ょ',
12
- 'わ' => 'ゎ',
13
- 'つ' => 'っ',
14
- 'は' => 'ゎ',
15
- '。' => 'o'
16
- }
17
-
18
- dic.each do |before, after|
19
- self.gsub!(/#{before}/, after)
20
- end
21
-
22
- self
3
+ self.gsub(/(\p{hiragana}{2})\1/, '\1②').tr(*ToGal::Dictionary::TR_ARGS)
23
4
  end
24
5
  end
@@ -1,3 +1,3 @@
1
1
  module ToGal
2
- VERSION = "0.0.2"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -81,5 +81,66 @@ describe String do
81
81
  it { should eq 'o' }
82
82
  end
83
83
 
84
+ context '繰り返し文字' do
85
+ context 'そもそも' do
86
+ subject { 'そもそも'.to_gal }
87
+
88
+ it { should eq 'そも②' }
89
+ end
90
+
91
+ context 'いろいろ' do
92
+ subject { 'いろいろ'.to_gal }
93
+
94
+ it { should eq 'ぃろ②' }
95
+ end
96
+ end
97
+ end
98
+
99
+ #
100
+ #
101
+ # Quotation From These Blogs
102
+ #
103
+ # ギャルでもゎかる自作pc
104
+ # http://ameblo.jp/upgrade-ayp/
105
+ #
106
+ # ayapi.github.io
107
+ # http://ayapi.github.io/
108
+ #
109
+ #
110
+ context '文章' do
111
+ context 'case1' do
112
+ let(:text) { '移動がとても多いよーなシーンではつらいけど、そーじゃなくて、おなじ場所にずっとあればいいなら、ベアボーン&USBディスプレイは、かなりおすすめ' }
113
+ subject { text.to_gal}
114
+
115
+ it { should eq '移動がとても多ぃょーなシーンでゎっらぃけど、そーじゃなくて、ぉなじ場所にずっとぁればぃぃなら、ベアボーン&USBディスプレイゎ、かなりぉすすめ' }
116
+ end
117
+
118
+ context 'case2' do
119
+ let(:text) { '安いのに、わりと、いいかんじだったよ' }
120
+ subject { text.to_gal}
121
+
122
+ it { should eq '安ぃのに、ゎりと、ぃぃかんじだったょ' }
123
+ end
124
+
125
+ context 'case3' do
126
+ let(:text) { 'まぁまぁそこそこわかってる系です(やたら詳しいわけでもないけど)' }
127
+ subject { text.to_gal}
128
+
129
+ it { should eq 'まぁ②そこ②ゎかってる系です(ゃたら詳しぃゎけでもなぃけど)' }
130
+ end
131
+
132
+ context 'case4' do
133
+ let(:text) { 'かなりやばくて、エラーが多いってゆーか' }
134
+ subject { text.to_gal}
135
+
136
+ it { should eq 'かなりゃばくて、エラーが多ぃってゅーか' }
137
+ end
138
+
139
+ context 'case5' do
140
+ let(:text) { 'getが1秒後に成功してから、sendが実行されますけどsendでは1秒後に必ずエラーが発生して、saveは実行されずにおわり、とゆーかんじです' }
141
+ subject { text.to_gal}
142
+
143
+ it { should eq 'getが1秒後に成功してから、sendが実行されますけどsendでゎ1秒後に必ずエラーが発生して、saveゎ実行されずにぉゎり、とゅーかんじです' }
144
+ end
84
145
  end
85
146
  end
@@ -1,4 +1,6 @@
1
1
  require 'bundler/setup'
2
+ require 'coveralls'
3
+ Coveralls.wear!
2
4
  Bundler.setup
3
5
 
4
6
  require 'to_gal'
@@ -21,4 +21,5 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "bundler", "~> 1.5"
22
22
  spec.add_development_dependency "rake"
23
23
  spec.add_development_dependency "rspec"
24
+ spec.add_development_dependency "coveralls"
24
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: to_gal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - onigra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-29 00:00:00.000000000 Z
11
+ date: 2014-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: coveralls
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  description: replace to gal-moji
56
70
  email:
57
71
  - 3280467rec@gmail.com
@@ -66,7 +80,9 @@ files:
66
80
  - LICENSE.txt
67
81
  - README.md
68
82
  - Rakefile
83
+ - data/dictionary.yml
69
84
  - lib/to_gal.rb
85
+ - lib/to_gal/dictionary.rb
70
86
  - lib/to_gal/extention/string.rb
71
87
  - lib/to_gal/version.rb
72
88
  - spec/extention/string_spec.rb