frosty_meadow 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/frosty_meadow.rb +14 -6
- metadata +2 -2
data/lib/frosty_meadow.rb
CHANGED
@@ -3,7 +3,7 @@ require 'json'
|
|
3
3
|
module FrostyMeadow
|
4
4
|
module Version
|
5
5
|
MAJOR = 2
|
6
|
-
MINOR =
|
6
|
+
MINOR = 2
|
7
7
|
PATCH = 0
|
8
8
|
|
9
9
|
FULL = [MAJOR, MINOR, PATCH].join('.')
|
@@ -25,6 +25,7 @@ module FrostyMeadow
|
|
25
25
|
|
26
26
|
class << self
|
27
27
|
@@words = []
|
28
|
+
@@cached_path = ''
|
28
29
|
|
29
30
|
def generate params = {}
|
30
31
|
words = get_words params
|
@@ -43,8 +44,13 @@ module FrostyMeadow
|
|
43
44
|
|
44
45
|
def get_words params = {}
|
45
46
|
|
46
|
-
if @@words.empty?
|
47
|
-
|
47
|
+
if @@words.empty? || !params[:skip_cache].nil? || params[:from_file] != @@cached_path
|
48
|
+
if params[:from_file].nil?
|
49
|
+
file_path = File.join(File.dirname(__FILE__), 'data/words.json')
|
50
|
+
else
|
51
|
+
file_path = params[:from_file]
|
52
|
+
end
|
53
|
+
|
48
54
|
file = File.new file_path, "r"
|
49
55
|
|
50
56
|
file_contents = ""
|
@@ -53,7 +59,9 @@ module FrostyMeadow
|
|
53
59
|
end
|
54
60
|
|
55
61
|
words = JSON.parse(file_contents)
|
56
|
-
|
62
|
+
|
63
|
+
@@words = words
|
64
|
+
@@cached_path = file_path
|
57
65
|
else
|
58
66
|
words = @@words
|
59
67
|
end
|
@@ -64,8 +72,8 @@ module FrostyMeadow
|
|
64
72
|
return words
|
65
73
|
end
|
66
74
|
|
67
|
-
def generate_hex_name
|
68
|
-
generated_string = self.generate(:separator => '-')
|
75
|
+
def generate_hex_name params = {}
|
76
|
+
generated_string = self.generate({:separator => '-'}.merge(params))
|
69
77
|
|
70
78
|
return "#{generated_string}-#{self::Hex.generate}"
|
71
79
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: frosty_meadow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-14 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: This gem will generate a random name for your server, much in the way
|
15
15
|
Heroku does.
|