randwordjp 0.0.16 → 0.0.17
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 +4 -4
- data/.travis.yml +2 -1
- data/lib/.randwordjp.rb.swp +0 -0
- data/lib/randwordjp/version.rb +1 -1
- data/lib/randwordjp.db +0 -0
- data/lib/randwordjp.rb +17 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ed00bdde6c75863fbf2ecdc9bd667be5db35679
|
4
|
+
data.tar.gz: 13a5fcd8b1421f11867b2ef05c3013ce1e649c56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7d2c3fc180dfff5cc6bf20262ed41bd425e4afdc8a6f1b839a65d2e45dddf2b5b9daa84f3a42abe1e57491fecc3ccadaa79df6bfcab44ab013096c6733ef951
|
7
|
+
data.tar.gz: 4df47dc98c845ecdd531df642fc450531e5bcb5d1e8a97075b0f62266c9a3cb64316e4313238c26d3d4dd3b8acd1bd8b330bdd25bba1cafdad6829e0c7208ffa
|
data/.travis.yml
CHANGED
Binary file
|
data/lib/randwordjp/version.rb
CHANGED
data/lib/randwordjp.db
CHANGED
Binary file
|
data/lib/randwordjp.rb
CHANGED
@@ -180,4 +180,21 @@ module Randwordjp
|
|
180
180
|
end
|
181
181
|
{ kanji: @namae_datum[:kanji], kana: @namae_datum[:yomi], gender: gender }
|
182
182
|
end
|
183
|
+
|
184
|
+
# 日本の郵便番号を取得します
|
185
|
+
# @param [Symbol] opt[:hyphen] true ハイフンありで出力 false ハイフン無しで出力
|
186
|
+
# @return [String] 郵便番号
|
187
|
+
def self.zip(opt = {hyphen: false } )
|
188
|
+
table = 'ziplist'
|
189
|
+
Sequel.connect(@db_connect) do |db|
|
190
|
+
data = db.from(table)
|
191
|
+
no = Random.rand(data.count)
|
192
|
+
data = data.select(:zip)
|
193
|
+
@zip_data = (data.limit(1).offset(no).first)[:zip]
|
194
|
+
end
|
195
|
+
if opt[:hyphen]
|
196
|
+
return @zip_data[0,3] + "-" + @zip_data[3,4]
|
197
|
+
end
|
198
|
+
return @zip_data
|
199
|
+
end
|
183
200
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: randwordjp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- inpwjp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sequel
|
@@ -82,6 +82,7 @@ files:
|
|
82
82
|
- LICENSE.txt
|
83
83
|
- README.md
|
84
84
|
- Rakefile
|
85
|
+
- lib/.randwordjp.rb.swp
|
85
86
|
- lib/randwordjp.db
|
86
87
|
- lib/randwordjp.rb
|
87
88
|
- lib/randwordjp.yml
|