aphorism 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aphorism.rb +6 -4
- data/lib/aphorism/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2c5b67b09c4a58e0b6a96264c953c58e9115d9dca462151e47a6a208f96f1fe
|
4
|
+
data.tar.gz: 86c37fb6b242d97e0db01d3af0dbd21b46e52c209eb33606706a873eafb28f83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ede685158caad67cccd720aa89348a32c28803f007388fe18e4d36c8c1be0d24076f8de68df58efaacdef63706fcbf1592a75dbd10375f470a2f5da46a0f986
|
7
|
+
data.tar.gz: 88a3bd68305d98bb5b305a6e913ee30cbe8071df3bbd5774a9a7092ca732de23e826a58d58f15fc2d2801cf7b3f011833e50cd0c994f32fc23cb74edd3eb500c
|
data/lib/aphorism.rb
CHANGED
@@ -9,11 +9,11 @@ module Aphorism
|
|
9
9
|
class Orator
|
10
10
|
def say
|
11
11
|
aphorisms = internal_aphorisms + custom_aphorisms
|
12
|
-
puts
|
12
|
+
puts aphorisms.sample
|
13
13
|
end
|
14
14
|
|
15
15
|
private
|
16
|
-
|
16
|
+
|
17
17
|
def internal_aphorisms
|
18
18
|
aphorisms_path = File.join(__dir__, 'content/aphorisms.txt')
|
19
19
|
IO.read(aphorisms_path).split("\n%\n")
|
@@ -21,9 +21,11 @@ module Aphorism
|
|
21
21
|
|
22
22
|
def custom_aphorisms
|
23
23
|
custom_path = File.join(Dir.home, '.aphorism')
|
24
|
-
custom_files = Dir.
|
24
|
+
custom_files = Dir.entries(custom_path) - ['.', '..']
|
25
25
|
custom_aphorisms = []
|
26
|
-
custom_files.each
|
26
|
+
custom_files.each do |file|
|
27
|
+
custom_aphorisms += IO.read(File.join(custom_path, file)).split("\n%\n")
|
28
|
+
end
|
27
29
|
custom_aphorisms
|
28
30
|
end
|
29
31
|
end
|
data/lib/aphorism/version.rb
CHANGED