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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 36d6656d6d57df266ed55a4dd2401e5f58e9ee38
4
- data.tar.gz: 9ab41c7e2c034c9b9979f6641bc33b358a9bffa2
3
+ metadata.gz: 6ed00bdde6c75863fbf2ecdc9bd667be5db35679
4
+ data.tar.gz: 13a5fcd8b1421f11867b2ef05c3013ce1e649c56
5
5
  SHA512:
6
- metadata.gz: 8be980ba0c27de4ae04a06f65772ae6193758702bb03aa89ee0e65bc09b1f0c1e500118c42e2945f71aa224a743df4c8ea6626aa898fa76576655df8e411052a
7
- data.tar.gz: 20e3e07af0e994d059360b3d74444220db60298438d1391ae031da5a114424a728e414280b0e33132aec543f5679ad46fe61987f78dfff30754fd82c9c3a00ec
6
+ metadata.gz: c7d2c3fc180dfff5cc6bf20262ed41bd425e4afdc8a6f1b839a65d2e45dddf2b5b9daa84f3a42abe1e57491fecc3ccadaa79df6bfcab44ab013096c6733ef951
7
+ data.tar.gz: 4df47dc98c845ecdd531df642fc450531e5bcb5d1e8a97075b0f62266c9a3cb64316e4313238c26d3d4dd3b8acd1bd8b330bdd25bba1cafdad6829e0c7208ffa
data/.travis.yml CHANGED
@@ -1,3 +1,4 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1.1
3
+ - 2.2.5
4
+ - jruby-1.7.19
Binary file
@@ -2,5 +2,5 @@
2
2
  # ランダムで日本語文字列などを生成するライブラリとなります。
3
3
  # can get random words(sentence).
4
4
  module Randwordjp
5
- VERSION = '0.0.16'
5
+ VERSION = '0.0.17'
6
6
  end
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.16
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-06 00:00:00.000000000 Z
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