dynarex-usersblog 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/dynarex-usersblog.rb +11 -7
- metadata +2 -2
data/lib/dynarex-usersblog.rb
CHANGED
@@ -8,22 +8,26 @@ require 'hashcache'
|
|
8
8
|
|
9
9
|
class DynarexUsersBlog
|
10
10
|
|
11
|
-
def initialize(
|
11
|
+
def initialize(options={})
|
12
|
+
|
13
|
+
o = {file_path: '.', user: ''}.merge(options)
|
12
14
|
|
13
15
|
threads = []
|
14
16
|
threads << Thread.new{
|
15
|
-
|
16
|
-
|
17
|
-
|
17
|
+
|
18
|
+
unless o[:user].empty? then
|
19
|
+
|
20
|
+
@current_user = o[:user]
|
21
|
+
@file_path = o[:file_path]
|
18
22
|
user_file_path = "%s/users/%s" % [@file_path, @current_user]
|
19
23
|
|
20
24
|
FileUtils.mkdir_p user_file_path
|
21
25
|
@hc_blog = HashCache.new
|
22
|
-
|
26
|
+
switch_user o[:user]
|
23
27
|
end
|
24
28
|
}
|
25
29
|
|
26
|
-
threads << Thread.new{@master_blog = DynarexBlog.new file_path}
|
30
|
+
threads << Thread.new{@master_blog = DynarexBlog.new o[:file_path]}
|
27
31
|
threads.each{|thread| thread.join}
|
28
32
|
|
29
33
|
super()
|
@@ -69,10 +73,10 @@ class DynarexUsersBlog
|
|
69
73
|
end
|
70
74
|
|
71
75
|
def switch_user(user)
|
76
|
+
|
72
77
|
user_file_path = "%s/users/%s" % [@file_path, user]
|
73
78
|
@user_blog = @hc_blog.read(user) { DynarexBlog.new user_file_path }
|
74
79
|
@current_blog = @user_blog
|
75
80
|
end
|
76
81
|
|
77
82
|
end
|
78
|
-
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dynarex-usersblog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors: []
|
7
7
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2011-01-14 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|