lorem_tolkien 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/lorem_tolkien.rb +76 -21
- data/lib/lorem_tolkien/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NGU1ZWFiMWIyOTI3NTQxMjBmNDE0YzE0MWY3Zjg5YjAyNjA3ODM2OQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NTViMWVjMGU4YjFmNDkzMTY1MjlmYzg0MmE0MzQ5YzU3YWMyZTMyMw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MDE2M2MyNTgyOThhYTk0OTZjOTRhMDg2YjAyYjBmMzJkMzk3NTY3YThlODU2
|
10
|
+
ZTZmOGViMjFlOTIzZTRmNDY3OGIwOGNjNThmOTc3NjI2NWMwZTEyMGU1NjI0
|
11
|
+
NjhhNTIxMTgzODQ5NWQ2NGYxZTViOGIwZmFlNTU2YjgwZTY2Njg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjFlZjdhZjU2MWMwMDU4ZjQ3M2YwMTllNGM3MjI4MTVlMTNmYzhkNmZjNmEx
|
14
|
+
ODkxYTEzZTUwMTUwYTYzZDI1NTE5MjUwMDUyZTIwMDlhN2Q2MTkwNjVjMjA3
|
15
|
+
OGQ5OGI2YjZkYjEwNzk0YzY1OWU1YTVlYzI5MjQ4YzRmMmE0NTA=
|
data/lib/lorem_tolkien.rb
CHANGED
@@ -1,29 +1,84 @@
|
|
1
1
|
require "lorem_tolkien/version"
|
2
2
|
|
3
3
|
module LoremTolkien
|
4
|
-
|
5
|
-
|
6
|
-
@source ||= self.read
|
7
|
-
end
|
8
|
-
|
9
|
-
def self.processed_source
|
10
|
-
@processed_source ||= self.source.split("\n").uniq
|
11
|
-
end
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
def self.read
|
16
|
-
File.read(File.expand_path('book/quotes.txt'))
|
17
|
-
end
|
4
|
+
def self.sentence
|
5
|
+
SOURCE[rand(0..(SOURCE.length - 1))]
|
18
6
|
end
|
19
7
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
def self.sentences(n=5)
|
26
|
-
self.processed_source.sample(n)
|
8
|
+
def self.sentences(n=5)
|
9
|
+
temp = ""
|
10
|
+
n.times do |x|
|
11
|
+
temp += SOURCE[x % SOURCE.length] + " "
|
27
12
|
end
|
13
|
+
return temp
|
28
14
|
end
|
15
|
+
|
16
|
+
SOURCE = [
|
17
|
+
"Do you wish me a good morning, or mean that it is a good morning whether I want it or not; or that you feel good this morning; or that it is a morning to be good on?",
|
18
|
+
"In a hole in the ground there lived a hobbit.",
|
19
|
+
"There is nothing like looking, if you want to find something.",
|
20
|
+
"You certainly usually find something, if you look, but it is not always quite the something you were after.",
|
21
|
+
"It does not do to leave a live dragon out of your calculations, if you live near him.",
|
22
|
+
"Far over the misty mountains cold",
|
23
|
+
"To dungeons deep and caverns old",
|
24
|
+
"We must away ere break of day",
|
25
|
+
"To seek the pale enchanted gold.",
|
26
|
+
"The dwarves of yore made mighty spells,",
|
27
|
+
"While hammers fell like ringing bells",
|
28
|
+
"In places deep, where dark things sleep,",
|
29
|
+
"In hollow halls beneath the fells.",
|
30
|
+
"For ancient king and elvish lord",
|
31
|
+
"There many a gleaming golden hoard",
|
32
|
+
"They shaped and wrought, and light they caught",
|
33
|
+
"To hide in gems on hilt of sword.",
|
34
|
+
"On silver necklaces they strung",
|
35
|
+
"The flowering stars, on crowns they hung",
|
36
|
+
"The dragon-fire, in twisted wire",
|
37
|
+
"They meshed the light of moon and sun.",
|
38
|
+
"Far over the misty mountains cold",
|
39
|
+
"To dungeons deep and caverns old",
|
40
|
+
"We must away, ere break of day,",
|
41
|
+
"To claim our long-forgotten gold.",
|
42
|
+
"Goblets they carved there for themselves",
|
43
|
+
"And harps of gold; where no man delves",
|
44
|
+
"There lay they long, and many a song",
|
45
|
+
"Was sung unheard by men or elves.",
|
46
|
+
"The pines were roaring on the height,",
|
47
|
+
"The wind was moaning in the night.",
|
48
|
+
"The fire was red, it flaming spread;",
|
49
|
+
"The trees like torches blazed with light.",
|
50
|
+
"The bells were ringing in the dale",
|
51
|
+
"And men looked up with faces pale;",
|
52
|
+
"The dragon's ire more fierce than fire",
|
53
|
+
"Laid low their towers and houses frail.",
|
54
|
+
"The mountain smoked beneath the moon;",
|
55
|
+
"The dwarves, they heard the tramp of doom.",
|
56
|
+
"They fled their hall to dying fall",
|
57
|
+
"Beneath his feet, beneath the moon.",
|
58
|
+
"Far over the misty mountains grim",
|
59
|
+
"To dungeons deep and caverns dim",
|
60
|
+
"We must away, ere break of day,",
|
61
|
+
"To win our harps and gold from him!",
|
62
|
+
"Where did you go to, if I may ask?' said Thorin to Gandalf as they rode along.",
|
63
|
+
"To look ahead,' said he.",
|
64
|
+
"And what brought you back in the nick of time?'",
|
65
|
+
"Looking behind,' said he.",
|
66
|
+
"Good Morning!' said Bilbo, and he meant it.",
|
67
|
+
"The sun was shining, and the grass was very green.",
|
68
|
+
"But Gandalf looked at him from under long bushy eyebrows that stuck out further than the brim of his shady hat.",
|
69
|
+
"'What do you mean?' he said.",
|
70
|
+
"'Do you wish me a good morning, or mean that it is a good morning whether I want it or not; or that you feel good this morning; or that it is a morning to be good on?'",
|
71
|
+
"'All of them at once,' said Bilbo.",
|
72
|
+
"'And a very fine morning for a pipe of tobacco out of doors, into the bargain.",
|
73
|
+
"'Good morning!' he said at last.",
|
74
|
+
"'We don't want any adventures here, thank you!",
|
75
|
+
"You might try over The Hill or across The Water.'",
|
76
|
+
"By this he meant that the conversation was at an end.",
|
77
|
+
"'What a lot of things you do use Good morning for!' said Gandalf.",
|
78
|
+
"'Now you mean that you want to get rid of me, and that it won't be good till I move off.",
|
79
|
+
"Where there's life there's hope.",
|
80
|
+
"You have nice manners for a thief and a liar,' said the dragon.",
|
81
|
+
"I am looking for someone to share in an adventure that I am arranging, and it's very difficult to find anyone.'",
|
82
|
+
"So comes snow after fire, and even dragons have their endings."
|
83
|
+
]
|
29
84
|
end
|