HyakuninIssyu 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7bf042c25359297101ac7411c5c0122a4ae83256
4
- data.tar.gz: 2e0fff49fcbad45da695391518abe3b3fecc5e27
3
+ metadata.gz: a59467c2855d6016fb9338c21b4f4edff3cdb769
4
+ data.tar.gz: 3911bc539a4e7ba247beba474a96bcc0d4888d81
5
5
  SHA512:
6
- metadata.gz: 456f397c3fd53d522ec30a9b210e01ec90b7822bf1c2b5b6751ddbdf5847ad8decea9b55c8ff3e7dc66206fcbf6e0b1a610f0423adf138e32433d0db1979c856
7
- data.tar.gz: 04f1b56a826b618c1cafc950d51fa5a6577e00d730ccc0ef1d16d86abdc5e47e2dd566296c2edfdf3fbed2c5a05486fc171951fb8ffb9614df1ef5815b3403f5
6
+ metadata.gz: 702fe53308dc58a95183afb105adccbc502c2fbb04101835509de63447077a28cdd1936b29c27d9e1fea50f304d22caa4f157d777d76552821ab79921b94b78d
7
+ data.tar.gz: 4d6d4cc2831f681df9c8fea4fe5cea5575f7cda544edc9168ebfd793dc022aca34c5967611d003e316a33624be4e879ac2b5497b474dda136223e01766dda6a8
data/README.md CHANGED
@@ -30,9 +30,15 @@ make the instance of HyakuninIssyu class with its poem id first.
30
30
  ###Poem Info | 歌情報の取得
31
31
  To retrieve the poem info,
32
32
 
33
- data.poem.full #=> "朝ぼらけ 宇治の川霧 たえだえに あらはれわたる 瀬々の網代木"
34
- data.poem.first #=> "朝ぼらけ宇治の川霧たえだえに"
35
- data.poem.last #=> "あらはれわたる瀬々の網代木"
33
+ data.poem.kanji #=> "朝ぼらけ 宇治の川霧 たえだえに あらはれわたる 瀬々の網代木"
34
+ data.poem.kana #=> "あさぼらけうじのかわぎりたえだえに あらはれわたるせぜのあじろぎ"
35
+
36
+ data.poem.first.kanji #=> "朝ぼらけ宇治の川霧たえだえに"
37
+ data.poem.first.kana #=> "あさぼらけうじのかわぎりたえだえに"
38
+
39
+ data.poem.last.kanji #=> "あらはれわたる瀬々の網代木"
40
+ data.poem.last.kana #=> "あらはれわたるせぜのあじろぎ"
41
+
36
42
  data.poem.comment #=> "「朝ぼらけ」は夜明けであたりがほのぼのと明るくなってくる頃..."
37
43
 
38
44
 
data/lib/HyakuninIssyu.rb CHANGED
@@ -21,31 +21,86 @@ class HyakuninIssyu
21
21
  @poem = poems[id-1]
22
22
  end
23
23
 
24
- def full
24
+ def kana
25
+ @poem["kana"]
26
+ end
27
+
28
+ def kanji
25
29
  @poem["poem"]
26
30
  end
27
31
 
32
+ def full
33
+ Full.new(@poem)
34
+ end
35
+
28
36
  def first
29
- poem_data = @poem["poem"].split(" ")
30
- first = ''
31
- for i in 0..2
32
- first << poem_data[i]
33
- end
34
- return first
37
+ First.new(@poem)
35
38
  end
36
39
 
37
40
  def last
38
- poem_data = @poem["poem"].split(" ")
39
- first = ''
40
- for i in 3..4
41
- first << poem_data[i]
42
- end
43
- return first
41
+ Last.new(@poem)
44
42
  end
45
43
 
46
44
  def comment
47
45
  @poem['comment']
48
46
  end
47
+
48
+ class Full
49
+ def initialize(data)
50
+ @full_kanji = data["poem"]
51
+ @full_kana = data["kana"]
52
+ end
53
+
54
+ def kanji
55
+ @full_kanji
56
+ end
57
+
58
+ def kana
59
+ @full_kana
60
+ end
61
+ end
62
+
63
+ class First
64
+ def initialize(data)
65
+ kanji_data = data["poem"].split(" ")
66
+ @first_kanji = ''
67
+ for i in 0..2
68
+ @first_kanji << kanji_data[i]
69
+ end
70
+
71
+ kana_data = data["kana"].split(" ")
72
+ @first_kana = kana_data[0]
73
+ end
74
+
75
+ def kana
76
+ @first_kana
77
+ end
78
+
79
+ def kanji
80
+ @first_kanji
81
+ end
82
+ end
83
+
84
+ class Last
85
+ def initialize(data)
86
+ kanji_data = data["poem"].split(" ")
87
+ @last_kanji = ''
88
+ for i in 3..4
89
+ @last_kanji << kanji_data[i]
90
+ end
91
+
92
+ kana_data = data["kana"].split(" ")
93
+ @last_kana = kana_data[1]
94
+ end
95
+
96
+ def kana
97
+ @last_kana
98
+ end
99
+
100
+ def kanji
101
+ @last_kanji
102
+ end
103
+ end
49
104
  end
50
105
 
51
106
  class Poet
@@ -1,3 +1,3 @@
1
1
  class HyakuninIssyu
2
- VERSION = "0.3.1"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: HyakuninIssyu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - tomomichi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-24 00:00:00.000000000 Z
11
+ date: 2013-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler