netzke-redis-persistence 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 45afb3cc8bd9431f81312b1c84e91c87d4fff279
4
- data.tar.gz: d7cb7c7c27e5eb57007e4bba3cf15ea2e18bf34d
3
+ metadata.gz: 18cd5ed0056e627a272378561023051558078ba4
4
+ data.tar.gz: 02e6279effacab8c8d650627ef703e960e5330fb
5
5
  SHA512:
6
- metadata.gz: 5f726cec5e9abf698a7ca355d5c76339968c9006b9719348cba5f746989aa98438e76476e4565228e7d0b6479718e431eaf08dc94df410a2dd956a11bef6b91f
7
- data.tar.gz: 3f97d7f35cbcaba7e85707e041be3956a7ed6d591c2e7995131146132a1786e32c62e9feb7bcc3017cc2ff82d3a9bc6573fc4867ff485cee7d18a98384cee4d9
6
+ metadata.gz: 601f2649ac0cffcd051e05eb094c81ff8415956622e4d5b780dc5dae2dcdacc74b8e1fac9c1078fe2a727b5480093898600ce5b6264c4ea1f3d73c774593b1de
7
+ data.tar.gz: 8fbd8e0361a811bdd4535b4ef6f428ee9b0259c17ed5fcf8e4774069fbca3be80e64c3092be032ad33ec419474561316481c886456e92fac27a76b82722862eb
data/README.md CHANGED
@@ -11,3 +11,12 @@ Add this to your Gemfile and run bundle install
11
11
  gem 'netzke-redis-persistence'
12
12
 
13
13
  Don't forget to install the redis server.
14
+
15
+ ## Configuration
16
+
17
+ If you are not using redis on localhost you can override the connection with an initializer:
18
+
19
+ NetzkeRedisPersistence.configure do |config|
20
+ config.redis_connection = Redis.new
21
+ end
22
+
@@ -1,6 +1,22 @@
1
1
  require "redis"
2
+ require "netzke_redis_persistence/configuration"
2
3
  require "netzke_redis_persistence/netzke_core_ext/state"
3
4
 
4
5
  module NetzkeRedisPersistence
6
+ class << self
7
+ attr_writer :configuration
8
+ end
9
+
10
+ def self.configuration
11
+ @configuration ||= Configuration.new
12
+ end
13
+
14
+ def self.reset
15
+ @configuration = Configuration.new
16
+ end
17
+
18
+ def self.configure
19
+ yield(configuration)
20
+ end
5
21
  end
6
22
  require "netzke_redis_persistence/store"
@@ -0,0 +1,10 @@
1
+
2
+ module NetzkeRedisPersistence
3
+ class Configuration
4
+ attr_accessor :redis_connection
5
+
6
+ def initialize
7
+ @redis_connection = Redis.new
8
+ end
9
+ end
10
+ end
@@ -3,7 +3,7 @@ module NetzkeRedisPersistence
3
3
  attr_accessor :redis, :custom_key
4
4
 
5
5
  def initialize(custom_key)
6
- @redis = Redis.new
6
+ @redis = NetzkeRedisPersistence.configuration.redis_connection
7
7
  @custom_key = custom_key
8
8
  end
9
9
 
@@ -1,3 +1,3 @@
1
1
  module NetzkeRedisPersistence
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: netzke-redis-persistence
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - firemind
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-27 00:00:00.000000000 Z
11
+ date: 2017-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: netzke-core
@@ -51,6 +51,7 @@ files:
51
51
  - Rakefile
52
52
  - init.rb
53
53
  - lib/netzke-redis-persistence.rb
54
+ - lib/netzke_redis_persistence/configuration.rb
54
55
  - lib/netzke_redis_persistence/netzke_core_ext/state.rb
55
56
  - lib/netzke_redis_persistence/store.rb
56
57
  - lib/netzke_redis_persistence/version.rb