dynarex-usersblog 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/dynarex-usersblog.rb +11 -7
  2. metadata +2 -2
@@ -8,22 +8,26 @@ require 'hashcache'
8
8
 
9
9
  class DynarexUsersBlog
10
10
 
11
- def initialize(file_path='.', user='')
11
+ def initialize(options={})
12
+
13
+ o = {file_path: '.', user: ''}.merge(options)
12
14
 
13
15
  threads = []
14
16
  threads << Thread.new{
15
- unless user.empty? then
16
- @current_user = user
17
- @file_path = file_path
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
- switch_user user
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
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: 2010-09-05 00:00:00 +01:00
12
+ date: 2011-01-14 00:00:00 +00:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency