haikunator 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +20 -2
- data/lib/haikunator/version.rb +1 -1
- data/lib/haikunator.rb +5 -10
- 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: fd8f532e514f39895a0f4354c94cb82d4eeae876
|
4
|
+
data.tar.gz: f9a648b600d5b0d2cdfcf6507dc099596b4f7c20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe51c0bc411d67a4f2149777676e62686cae191a8b7d7c8675f43a909df34abc988f27182346819e46dacd0a7636585799bd013dc2e97add4ea1d103b857cfce
|
7
|
+
data.tar.gz: 6c6047dc844e60b9192cb975c74fc212215c25228a1f57eefe8629debcec19d574241ddec52d01bae34be7cca91c9a6c00bb674687efb5b9a7b014c54d9c0a6d
|
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# Haikunator
|
2
2
|
|
3
|
-
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/haikunator.svg)](http://badge.fury.io/rb/haikunator)
|
4
|
+
|
5
|
+
Generate Heroku-like memorable random names to use in your apps or anywhere else.
|
4
6
|
|
5
7
|
## Installation
|
6
8
|
|
@@ -18,7 +20,23 @@ Or install it yourself as:
|
|
18
20
|
|
19
21
|
## Usage
|
20
22
|
|
21
|
-
|
23
|
+
Haikunator is pretty simple. There is nothing to configure and it only has a single method, `.haikunate`:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
Haikunator.haikunate # => "rough-snowflake-1142"
|
27
|
+
|
28
|
+
# Token range
|
29
|
+
Haikunator.haikunate(100) # => "nameless-star-13"
|
30
|
+
|
31
|
+
# Don't include the token
|
32
|
+
Haikunator.haikunate(0) # => "long-flower"
|
33
|
+
|
34
|
+
# Use a different delimiter
|
35
|
+
Haikunator.haikunate(9999, '.') # => "cool.leaf.6743"
|
36
|
+
|
37
|
+
# No token, no delimiter
|
38
|
+
Haikunator.haikunate(0, ' ') # => "green fire"
|
39
|
+
```
|
22
40
|
|
23
41
|
## Contributing
|
24
42
|
|
data/lib/haikunator/version.rb
CHANGED
data/lib/haikunator.rb
CHANGED
@@ -4,7 +4,7 @@ require 'securerandom'
|
|
4
4
|
module Haikunator
|
5
5
|
class << self
|
6
6
|
|
7
|
-
def
|
7
|
+
def haikunate(token_range = 9999, delimiter = '-')
|
8
8
|
rnd = (rand * (2 ** 12)).floor
|
9
9
|
|
10
10
|
sections = []
|
@@ -14,7 +14,6 @@ module Haikunator
|
|
14
14
|
|
15
15
|
sections.compact.join(delimiter)
|
16
16
|
end
|
17
|
-
alias_method :haikunate, :generate
|
18
17
|
|
19
18
|
private
|
20
19
|
|
@@ -23,8 +22,7 @@ module Haikunator
|
|
23
22
|
end
|
24
23
|
|
25
24
|
def adjectives
|
26
|
-
%w[
|
27
|
-
autumn hidden bitter misty silent empty dry dark
|
25
|
+
%w[autumn hidden bitter misty silent empty dry dark
|
28
26
|
summer icy delicate quiet white cool spring winter
|
29
27
|
patient twilight dawn crimson wispy weathered blue
|
30
28
|
billowing broken cold damp falling frosty green
|
@@ -32,13 +30,11 @@ module Haikunator
|
|
32
30
|
red rough still small sparkling throbbing shy
|
33
31
|
wandering withered wild black young holy solitary
|
34
32
|
fragrant aged snowy proud floral restless divine
|
35
|
-
polished ancient purple lively nameless
|
36
|
-
]
|
33
|
+
polished ancient purple lively nameless]
|
37
34
|
end
|
38
35
|
|
39
36
|
def nouns
|
40
|
-
%w[
|
41
|
-
waterfall river breeze moon rain wind sea morning
|
37
|
+
%w[waterfall river breeze moon rain wind sea morning
|
42
38
|
snow lake sunset pine shadow leaf dawn glitter
|
43
39
|
forest hill cloud meadow sun glade bird brook
|
44
40
|
butterfly bush dew dust field fire flower firefly
|
@@ -46,8 +42,7 @@ module Haikunator
|
|
46
42
|
snowflake silence sound sky shape surf thunder
|
47
43
|
violet water wildflower wave water resonance sun
|
48
44
|
wood dream cherry tree fog frost voice paper
|
49
|
-
frog smoke star
|
50
|
-
]
|
45
|
+
frog smoke star]
|
51
46
|
end
|
52
47
|
|
53
48
|
end
|