HyakuninIssyu 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/HyakuninIssyu.rb +49 -4
- data/lib/HyakuninIssyu/version.rb +1 -1
- data/lib/data/{authors.yml → poets.yml} +0 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de7a75f3443ac869a3fefbe03b3434cd991dde33
|
4
|
+
data.tar.gz: f91bf8da91999273c46827db8d7c63bd78803728
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52f334795d3bb5d152f5aaa772282c512f07a62a32c64dd820aaa568282e7ed85c2ec18d45c94498118fdef2f5093f9a69427fd2b442cd3a4de2db2a97a350c3
|
7
|
+
data.tar.gz: a3f0d9b97a8b26bf02af9ef392f16be48f0e026748caf31c999428cfec0021ae742365f16380ef3d66f9027dd543846e1e7eb5777471948ad5f986789670a7da
|
data/lib/HyakuninIssyu.rb
CHANGED
@@ -2,10 +2,55 @@ require "HyakuninIssyu/version"
|
|
2
2
|
require "yaml"
|
3
3
|
|
4
4
|
module HyakuninIssyu
|
5
|
-
|
6
|
-
|
5
|
+
class Poem
|
6
|
+
def initialize(id)
|
7
|
+
poems = YAML.load_file(File.expand_path(File.join('..', 'data', 'poems.yml'), __FILE__))
|
8
|
+
@poem = poems[id-1]
|
9
|
+
end
|
7
10
|
|
8
|
-
|
11
|
+
def full
|
12
|
+
@poem["poem"]
|
13
|
+
end
|
14
|
+
|
15
|
+
def first
|
16
|
+
poem_data = @poem["poem"].split(" ")
|
17
|
+
first = ''
|
18
|
+
for i in 0..2
|
19
|
+
first << poem_data[i]
|
20
|
+
end
|
21
|
+
return first
|
22
|
+
end
|
23
|
+
|
24
|
+
def last
|
25
|
+
poem_data = @poem["poem"].split(" ")
|
26
|
+
first = ''
|
27
|
+
for i in 3..4
|
28
|
+
first << poem_data[i]
|
29
|
+
end
|
30
|
+
return first
|
31
|
+
end
|
32
|
+
|
33
|
+
def comment
|
34
|
+
@poem['comment']
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
class Poet
|
39
|
+
def initialize(id)
|
40
|
+
poets = YAML.load_file(File.expand_path(File.join('..', 'data', 'poets.yml'), __FILE__))
|
41
|
+
@poet = poets[id-1]
|
42
|
+
end
|
43
|
+
|
44
|
+
def name
|
45
|
+
@poet['name']
|
46
|
+
end
|
47
|
+
|
48
|
+
def period
|
49
|
+
@poet['period']
|
50
|
+
end
|
51
|
+
|
52
|
+
def info
|
53
|
+
@poet['info']
|
54
|
+
end
|
9
55
|
end
|
10
|
-
module_function :poem
|
11
56
|
end
|
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: HyakuninIssyu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tomomichi
|
@@ -53,8 +53,8 @@ files:
|
|
53
53
|
- Rakefile
|
54
54
|
- lib/HyakuninIssyu.rb
|
55
55
|
- lib/HyakuninIssyu/version.rb
|
56
|
-
- lib/data/authors.yml
|
57
56
|
- lib/data/poems.yml
|
57
|
+
- lib/data/poets.yml
|
58
58
|
homepage: https://github.com/Tomomichi/HyakuninIssyu
|
59
59
|
licenses:
|
60
60
|
- MIT
|