HyakuninIssyu 0.4.0 → 0.4.1
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/README.md +8 -1
- data/lib/HyakuninIssyu.rb +23 -7
- data/lib/HyakuninIssyu/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0203186a1ced637afb58f7b73592b3bd629c5f7
|
4
|
+
data.tar.gz: 86aa0267d2063a56513da3dd59ef5779bae5a8c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be342dd00e9e00bbe61bfc3e4816f77c135720a2366bf685dd6fbbc51ad4c5b09f49d22bda63d89c41ba5fcc659c3058f32fe7b475c7126b5659bf78e5f85820
|
7
|
+
data.tar.gz: 6b9802364d9ca8bf3877f187ee18d59aa4ddc5dd48ebe6ddedfa4c01209da1f401031d826a09efdb40fa4125fb5b396d41e3bc1b895cec200265008ea5383a21
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# HyakuninIssyu
|
2
2
|
|
3
3
|
"HyakuninIssyu" is a Gem for installing poems and poets info of Hyakunin-Issyu, 100 poems by 100 poets into your apps.
|
4
|
-
You can take any poems of Hyakunin-Issyu, poets info and a commentary on it, in addition
|
4
|
+
You can take any poems of Hyakunin-Issyu, poets info and a commentary on it, in addition to the feature to take the first or last half of the poem.
|
5
5
|
(it may be necessary for building game style Hyakunin-Issyu application)
|
6
6
|
|
7
7
|
HyakuninIssyuは、百人一首の歌情報・歌人情報をアプリに取り込むためのGemです。
|
@@ -27,6 +27,8 @@ make the instance of HyakuninIssyu class with its poem id first.
|
|
27
27
|
|
28
28
|
data = HyakuninIssyu.new(64)
|
29
29
|
|
30
|
+
If you don't pass the poem id, it retrieve the data of the first poem by Tenchi-Tennoh.
|
31
|
+
|
30
32
|
###Poem Info | 歌情報の取得
|
31
33
|
To retrieve the poem info,
|
32
34
|
|
@@ -41,6 +43,9 @@ To retrieve the poem info,
|
|
41
43
|
|
42
44
|
data.poem.comment #=> "「朝ぼらけ」は夜明けであたりがほのぼのと明るくなってくる頃..."
|
43
45
|
|
46
|
+
data.poem.list #=> ["秋の田の かりほの庵の 苫をあらみ わが衣手は 露にぬれつつ", "春過ぎて..."]
|
47
|
+
|
48
|
+
"list" method returns all the poem data in array.
|
44
49
|
|
45
50
|
###Poet Info | 歌人情報の取得
|
46
51
|
To retrieve the poet info for the same poem,
|
@@ -48,7 +53,9 @@ To retrieve the poet info for the same poem,
|
|
48
53
|
data.poet.name #=> "権中納言定頼"
|
49
54
|
data.poet.period #=> "995-1045"
|
50
55
|
data.poet.info #=> "本名は藤原定頼(ふじわらの さだより)。平安時代中期の公家・歌人..."
|
56
|
+
data.poet.list #=> ["天智天皇", "持統天皇", "柿本人麻呂", ... "]
|
51
57
|
|
58
|
+
"list" method returns all the poet names in array.
|
52
59
|
|
53
60
|
## Contributing
|
54
61
|
|
data/lib/HyakuninIssyu.rb
CHANGED
@@ -2,7 +2,7 @@ require "HyakuninIssyu/version"
|
|
2
2
|
require "yaml"
|
3
3
|
|
4
4
|
class HyakuninIssyu
|
5
|
-
def initialize(id)
|
5
|
+
def initialize(id=nil)
|
6
6
|
@poem = Poem.new(id)
|
7
7
|
@poet = Poet.new(id)
|
8
8
|
end
|
@@ -16,9 +16,17 @@ class HyakuninIssyu
|
|
16
16
|
end
|
17
17
|
|
18
18
|
class Poem
|
19
|
-
def initialize(id)
|
20
|
-
poems = YAML.load_file(File.expand_path(File.join('..', 'data', 'poems.yml'), __FILE__))
|
21
|
-
@poem = poems[id-1]
|
19
|
+
def initialize(id=nil)
|
20
|
+
@poems = YAML.load_file(File.expand_path(File.join('..', 'data', 'poems.yml'), __FILE__))
|
21
|
+
@poem = id ? @poems[id-1] : @poems[0]
|
22
|
+
end
|
23
|
+
|
24
|
+
def list
|
25
|
+
list = Array.new
|
26
|
+
for i in 0..99
|
27
|
+
list << @poems[i]['poem']
|
28
|
+
end
|
29
|
+
return list
|
22
30
|
end
|
23
31
|
|
24
32
|
def kana
|
@@ -104,9 +112,17 @@ class HyakuninIssyu
|
|
104
112
|
end
|
105
113
|
|
106
114
|
class Poet
|
107
|
-
def initialize(id)
|
108
|
-
poets = YAML.load_file(File.expand_path(File.join('..', 'data', 'poets.yml'), __FILE__))
|
109
|
-
@poet = poets[id-1]
|
115
|
+
def initialize(id=nil)
|
116
|
+
@poets = YAML.load_file(File.expand_path(File.join('..', 'data', 'poets.yml'), __FILE__))
|
117
|
+
@poet = id ? @poets[id-1] : @poets[0]
|
118
|
+
end
|
119
|
+
|
120
|
+
def list
|
121
|
+
list = Array.new
|
122
|
+
for i in 0..99
|
123
|
+
list << @poets[i]['name']
|
124
|
+
end
|
125
|
+
return list
|
110
126
|
end
|
111
127
|
|
112
128
|
def name
|