lolem 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +27 -0
- data/lib/lolem.rb +6 -7
- data/lib/lolem/generator.rb +3 -2
- data/lib/lolem/version.rb +1 -1
- metadata +5 -4
data/README.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
LOLem Ipsum
|
2
|
+
=============
|
3
|
+
|
4
|
+
Random latin text getting you down? Put on your lollerskates and install this gem (LOLZ).
|
5
|
+
|
6
|
+
|
7
|
+
Installation
|
8
|
+
------------
|
9
|
+
|
10
|
+
$ gem install lolem
|
11
|
+
|
12
|
+
Install the lolem gem from [rubygems](https://rubygems.org/gems/lolem)
|
13
|
+
|
14
|
+
|
15
|
+
Usage (CLI)
|
16
|
+
-----------
|
17
|
+
|
18
|
+
$ lolem 40
|
19
|
+
|
20
|
+
Generates 40 words of Lolem Ipsum (default is 30)
|
21
|
+
|
22
|
+
|
23
|
+
Usage (Ruby)
|
24
|
+
---------
|
25
|
+
|
26
|
+
lolz = Lolem.new
|
27
|
+
puts lolz.words 50
|
data/lib/lolem.rb
CHANGED
@@ -12,10 +12,9 @@ class Lolem
|
|
12
12
|
|
13
13
|
def words n
|
14
14
|
words = []
|
15
|
-
word = ''
|
16
15
|
(0...n).each do
|
17
|
-
word = @generator.get word
|
18
|
-
words << word
|
16
|
+
@word = @generator.get @word
|
17
|
+
words << @word
|
19
18
|
end
|
20
19
|
|
21
20
|
words.join ' '
|
@@ -25,9 +24,9 @@ class Lolem
|
|
25
24
|
Lolem ipsum loller sit amet, consectetur adipisicing elit,
|
26
25
|
sed do eiusmod tempor incididunt ut lolerskates et dolore magna
|
27
26
|
aliqua. Ut enim lol ad minim veniam, quis nostrud exercitation
|
28
|
-
ullamco. Lol-athon nisi ut
|
27
|
+
ullamco. Lol-athon nisi ut lollergram ex ea commodo consequat.
|
29
28
|
Duis aute irure loller in reprehenderit in voluptate velit
|
30
|
-
esse cillum
|
29
|
+
esse cillum dololler eu fugiat nulla pariatur. Lolburger sint
|
31
30
|
occaecat cupidatat non proident, sunt in lolcano qui officia
|
32
31
|
deserunt mollit lolz anim id est laborum.
|
33
32
|
END
|
@@ -35,5 +34,5 @@ class Lolem
|
|
35
34
|
|
36
35
|
end
|
37
36
|
|
38
|
-
#
|
39
|
-
#puts
|
37
|
+
# lolz = Lolem.new
|
38
|
+
# puts lolz.words(50)
|
data/lib/lolem/generator.rb
CHANGED
@@ -2,11 +2,10 @@
|
|
2
2
|
# not very efficient, but works for what we need it for
|
3
3
|
class Generator
|
4
4
|
|
5
|
-
def initialize
|
5
|
+
def initialize
|
6
6
|
# hash with a default value of another
|
7
7
|
# hash with a default value of zero
|
8
8
|
@map = Hash.new {|h,k| h[k] = Hash.new 0}
|
9
|
-
@last = start
|
10
9
|
end
|
11
10
|
|
12
11
|
|
@@ -26,6 +25,8 @@ class Generator
|
|
26
25
|
@map[given].each do |k,v|
|
27
26
|
return k if (index -= v) < 0
|
28
27
|
end
|
28
|
+
|
29
|
+
nil # back to the start
|
29
30
|
|
30
31
|
end
|
31
32
|
|
data/lib/lolem/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lolem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ben Foxall
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-03-
|
18
|
+
date: 2011-03-05 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -31,6 +31,7 @@ extra_rdoc_files: []
|
|
31
31
|
files:
|
32
32
|
- .gitignore
|
33
33
|
- Gemfile
|
34
|
+
- README.md
|
34
35
|
- Rakefile
|
35
36
|
- bin/lolem
|
36
37
|
- lib/lolem.rb
|