rzicon 0.0.1 → 0.0.2

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: 09c8dfbb92eab7d30251c345765b4add99707630
4
- data.tar.gz: 5bfa9b85762f36b98f2d310fd2b8646be271b842
3
+ metadata.gz: 776b1fe440158660c89b85b15768fa0f7db9ea6e
4
+ data.tar.gz: 8a4b76cf80ef2570f4396ad0d3cf8f9c8a0d33bf
5
5
  SHA512:
6
- metadata.gz: efef5dee3b6b22e0d0ccd159e69812e726a4d18e805ef9f982fff16b4d7ad3bd8ac7e866725985c40c63f6e6d765b1d036dbf6e36f6b635749706958d1f4edbf
7
- data.tar.gz: 4211deefb2bcc4fd8974fe658d1cfd1edbb49576edd83879aaee3e186afc2e7ab47b3b559a663078348d433b63a31002c3cb22c680d783401b36e5201147f08e
6
+ metadata.gz: 38780a84d13b1580c3e818eed5ffa3a99c63a0adfdfca16dc7b6640d36e86897f6c320d6bab80ad6c3ab0bf5686288f7f616d19dfd2bbdb54e388fdec536bcfc
7
+ data.tar.gz: 88365305c8b2f3b008e6d5a5052e111fb2e9bf0238d49ce9f569506b24b5e34939a83a9cff998d723375645ac187fa181c68800fdd20b4b985f5069d9b5732b3
data/README.md CHANGED
@@ -25,23 +25,35 @@ Nizicon.members.all
25
25
  #<Nizicon::Members::MatobaKarin:0x00000000000000>,
26
26
  #<Nizicon::Members::YoshimuraNana:0x00000000000000>]
27
27
 
28
- Nizicon.members.each{|m| puts m.name}
29
- 長田 美成
30
- 重松 佑佳
31
- 奥村 野乃花
32
- 木下 ひより
33
- 陶山 恵実里
34
- 中村 朱里
35
- 西 七海
36
- 根本 凪
37
- 的場 華鈴
38
- 吉村 菜々
28
+ Nizicon.members.map(&:name)
29
+ #=> ["長田 美成", "重松 佑佳", "奥村 野乃花", "木下 ひより", "陶山 恵実里", "中村 朱里", "西 七海", "根本 凪", "的場 華鈴", "吉村 菜々"]
30
+
31
+ Nizicon.members.map(&:nickname)
32
+ #=> ["みなりん", "しげちー", "ののた", "ひよりん", "えみりぃ", "あかりん", "ななぴ", "ねも", "かりんさま", "なぁな"]
33
+
34
+ Nizicon.members.map(&:to_s)
35
+ #=> ["みなりん", "しげちー", "ののた", "ひよりん", "えみりぃ", "あかりん", "ななぴ", "ねも", "かりんさま", "ハム"]
36
+
37
+ Nizicon.members.all.sample.to_hash
38
+ #=> {:name=>"根本 凪",
39
+ :nickname=>"ねも",
40
+ :birthday=>#<Date: 1999-03-15 ((2451253j,0s,0n),+0s,2299161j)>,
41
+ :hometown=>"茨城県",
42
+ :twitter_id=>"@nemoto_nagi",
43
+ :pixiv_id=>"11797412",
44
+ :introduction=>["みんなのハートをねも色に染めちゃってもよかっぺか?", "\ぺー!/", "茨城県出身世間知らずの15歳。", "ねもこと根本 凪です。"],
45
+ :blog_uri=>#<URI::HTTP:0x007fc1198fbd58 URL:http://ameblo.jp/2zicon/theme-10083290733.html>,
46
+ :to_s=>"ねも"}
39
47
  ```
40
48
 
41
49
  more member information: https://github.com/bash0C7/rzicon/blob/master/lib/nizicon/members.rb
42
50
 
43
51
  ## Change Log
44
52
 
53
+ ### Version 0.0.2
54
+
55
+ Support <member>#to_hash
56
+
45
57
  ### Version 0.0.1
46
58
 
47
59
  Fix some issues.
@@ -2,6 +2,7 @@ module Nizicon
2
2
  require "singleton"
3
3
  require 'date'
4
4
  require 'uri'
5
+ require 'json'
5
6
 
6
7
  class Members
7
8
  include Singleton
@@ -11,6 +12,15 @@ module Nizicon
11
12
  def age current_date = Date.today
12
13
  current_date.year - birthday.year - (current_date.yday < birthday.yday ? 1 : 0)
13
14
  end
15
+
16
+ def to_hash
17
+ public_methods(false).inject({}) do |h, m|
18
+ h[m] = public_send(m)
19
+
20
+ h
21
+ end
22
+
23
+ end
14
24
  end
15
25
 
16
26
  def all
@@ -1,3 +1,3 @@
1
1
  module Nizicon
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/spec/members_spec.rb CHANGED
@@ -13,6 +13,12 @@ describe Nizicon::Members do
13
13
  expect(described_class.instance.all.each).not_to be_nil
14
14
  end
15
15
 
16
+ describe described_class.instance.all.sample.class do
17
+ it 'to_hash' do
18
+ expect(described_class.instance.to_hash.class).to eq(Hash)
19
+ end
20
+ end
21
+
16
22
  describe described_class::NagataMinari do
17
23
  it 'birthday' do
18
24
  expect(described_class.instance.birthday.to_s).to eq('1997-12-17')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rzicon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - bash0C7
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-11 00:00:00.000000000 Z
11
+ date: 2014-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler