pg_lock 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c24490141a8dd6d9d3903c84120a9635c561a029
4
- data.tar.gz: 6e5408ba72c4eed608a141dc34e3778402d7cda9
3
+ metadata.gz: d4751ff801966253cdbd7662bf288c44251b0c50
4
+ data.tar.gz: a826d5ee152d541b70dbd1a448cfabd005f6e100
5
5
  SHA512:
6
- metadata.gz: 78c5bcf7287fed34d351ab5bb053d28bd0d9da26275ad09f52ef011f36cf188a09ba6239eec991e52d51d3b2c5e63d56232cc9b505486f2049392d9cbb0ad6bd
7
- data.tar.gz: d88848d3287d74314e4a8240d7404a3d7e3515da93da5e526f7fc7716070cf3e1188addd4969e5272e6197b60cf04a87d45c23738b9b6c6f5ed2df074f52263b
6
+ metadata.gz: 44720df9698d51ec531713d26faa8379df673b408b686892413af5122f32d8f1b7517561354bcacbc9ba0e323e4aa6b2a875cf49340f4d877b057757b14ee43e
7
+ data.tar.gz: 073c50e4bd05804b57cc22d019b4ca5def74c21032e52d9a31d9fcff20ca49da3fc72e0098c1292fdde2f20b6eef6638a91dd634c0accc9013015cc5e6484af7
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # A Log of Changes!
2
2
 
3
+ ## [0.1.1] - 2015-10-07
4
+
5
+ - Allow setting default connection with constant.
6
+
3
7
  ## [0.1.0] - 2015-10-06
4
8
 
5
9
  - First version.
data/lib/pg_lock.rb CHANGED
@@ -5,8 +5,14 @@ require "pg_lock/version"
5
5
 
6
6
  class PgLock
7
7
  PG_LOCK_SPACE = -2147483648
8
- DEFAULT_CONNECTION = Proc.new do
9
- defined?(ActiveRecord::Base) ? ActiveRecord::Base.connection.raw_connection : false
8
+ DEFAULT_CONNECTION_CONNECTOR = Proc.new do
9
+ if defined?(DEFAULT_CONNECTION)
10
+ DEFAULT_CONNECTION
11
+ elsif defined?(ActiveRecord::Base)
12
+ ActiveRecord::Base.connection.raw_connection
13
+ else
14
+ false
15
+ end
10
16
  end
11
17
 
12
18
  DEFAULT_LOGGER = Proc.new do
@@ -21,7 +27,7 @@ class PgLock
21
27
  end
22
28
  UnableToLock = UnableToLockError
23
29
 
24
- def initialize(name:, attempts: 3, attempt_interval: 1, ttl: 60, connection: DEFAULT_CONNECTION.call, log: DEFAULT_LOGGER.call )
30
+ def initialize(name:, attempts: 3, attempt_interval: 1, ttl: 60, connection: DEFAULT_CONNECTION_CONNECTOR.call, log: DEFAULT_LOGGER.call )
25
31
  self.name = name
26
32
  self.max_attempts = [attempts, 1].max
27
33
  self.attempt_interval = attempt_interval
@@ -1,3 +1,3 @@
1
1
  class PgLock
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_lock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - mikehale
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2015-10-06 00:00:00.000000000 Z
12
+ date: 2015-10-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pg