filecluster 0.0.3 → 0.0.4

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.
Files changed (3) hide show
  1. data/lib/fc/db.rb +9 -2
  2. data/lib/fc/version.rb +1 -1
  3. metadata +3 -3
@@ -4,12 +4,12 @@ module FC
4
4
  module DB
5
5
  class << self; attr_accessor :options, :prefix end
6
6
 
7
- def DB.connect_by_config(options)
7
+ def self.connect_by_config(options)
8
8
  @options = options.clone
9
9
  @options[:port] = options[:port].to_i if options[:port]
10
+ @prefix = options[:prefix].to_s
10
11
  @connects = {}
11
12
  @connects[Thread.current.object_id] = Mysql2::Client.new(@options)
12
- @prefix = options[:prefix].to_s
13
13
  end
14
14
 
15
15
  def self.connect
@@ -20,6 +20,13 @@ module FC
20
20
  end
21
21
  end
22
22
 
23
+ def self.connect=(connect, options = {})
24
+ @options = connect.query_options.merge(options)
25
+ @prefix = @options[:prefix].to_s
26
+ @connects = {}
27
+ @connects[Thread.current.object_id] = connect
28
+ end
29
+
23
30
  def self.close
24
31
  if @options[:multi_threads]
25
32
  if @connects[Thread.current.object_id]
@@ -1,3 +1,3 @@
1
1
  module FC
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filecluster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -170,7 +170,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
170
170
  version: '0'
171
171
  segments:
172
172
  - 0
173
- hash: 3834246548057884252
173
+ hash: 3114607092367906518
174
174
  required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  none: false
176
176
  requirements:
@@ -179,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
179
179
  version: '0'
180
180
  segments:
181
181
  - 0
182
- hash: 3834246548057884252
182
+ hash: 3114607092367906518
183
183
  requirements: []
184
184
  rubyforge_project:
185
185
  rubygems_version: 1.8.24