multi-leaderboard 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.4
1
+ 1.0.5
@@ -1,21 +1,17 @@
1
1
  require 'redis'
2
2
 
3
3
  class Leaderboard
4
- VERSION = '1.0.4'.freeze
4
+ VERSION = '1.0.5'.freeze
5
5
 
6
6
  DEFAULT_PAGE_SIZE = 25
7
7
  DEFAULT_REDIS_HOST = 'localhost'
8
8
  DEFAULT_REDIS_PORT = 6379
9
9
 
10
- attr_reader :host
11
- attr_reader :port
12
10
  attr_reader :leaderboard_name
13
11
  attr_accessor :page_size
14
12
 
15
13
  def initialize(leaderboard_name, host = DEFAULT_REDIS_HOST, port = DEFAULT_REDIS_PORT, page_size = DEFAULT_PAGE_SIZE, redis_options = {})
16
14
  @leaderboard_name = leaderboard_name
17
- @host = host
18
- @port = port
19
15
 
20
16
  if page_size < 1
21
17
  page_size = DEFAULT_PAGE_SIZE
@@ -24,8 +20,8 @@ class Leaderboard
24
20
  @page_size = page_size
25
21
 
26
22
  redis_options = redis_options.dup
27
- redis_options[:host] ||= @host
28
- redis_options[:port] ||= @port
23
+ redis_options[:host] ||= host
24
+ redis_options[:port] ||= port
29
25
 
30
26
  @redis_options = redis_options
31
27
 
@@ -209,6 +205,18 @@ class Leaderboard
209
205
  def disconnect
210
206
  @@redis_connection.client.disconnect
211
207
  end
208
+
209
+ class << self
210
+
211
+ def redis_connection=(redis)
212
+ @@redis_connection = redis
213
+ end
214
+
215
+ def redis_connection
216
+ @@redis_connection
217
+ end
218
+
219
+ end
212
220
 
213
221
  private
214
222
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{multi-leaderboard}
8
- s.version = "1.0.4"
8
+ s.version = "1.0.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["David Czarnecki", "Will Cosgrove"]
@@ -25,12 +25,12 @@ Gem::Specification.new do |s|
25
25
  "README.rdoc",
26
26
  "Rakefile",
27
27
  "VERSION",
28
- "leaderboard.gemspec",
29
- "lib/leaderboard.rb",
28
+ "multi-leaderboard.gemspec",
29
+ "lib/multi-leaderboard.rb",
30
30
  "test/db/.gitkeep",
31
31
  "test/helper.rb",
32
32
  "test/test.conf",
33
- "test/test_leaderboard.rb"
33
+ "test/test_multi-leaderboard.rb"
34
34
  ]
35
35
  s.homepage = %q{http://github.com/willcosgrove/leaderboard}
36
36
  s.licenses = ["MIT"]
@@ -39,7 +39,7 @@ Gem::Specification.new do |s|
39
39
  s.summary = %q{Leaderboards backed by Redis in Ruby}
40
40
  s.test_files = [
41
41
  "test/helper.rb",
42
- "test/test_leaderboard.rb"
42
+ "test/test_multi-leaderboard.rb"
43
43
  ]
44
44
 
45
45
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multi-leaderboard
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 4
10
- version: 1.0.4
9
+ - 5
10
+ version: 1.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Czarnecki
@@ -99,12 +99,12 @@ files:
99
99
  - README.rdoc
100
100
  - Rakefile
101
101
  - VERSION
102
- - leaderboard.gemspec
103
- - lib/leaderboard.rb
102
+ - multi-leaderboard.gemspec
103
+ - lib/multi-leaderboard.rb
104
104
  - test/db/.gitkeep
105
105
  - test/helper.rb
106
106
  - test/test.conf
107
- - test/test_leaderboard.rb
107
+ - test/test_multi-leaderboard.rb
108
108
  has_rdoc: true
109
109
  homepage: http://github.com/willcosgrove/leaderboard
110
110
  licenses:
@@ -141,4 +141,4 @@ specification_version: 3
141
141
  summary: Leaderboards backed by Redis in Ruby
142
142
  test_files:
143
143
  - test/helper.rb
144
- - test/test_leaderboard.rb
144
+ - test/test_multi-leaderboard.rb