redness 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 19b1d4771f2956fcfbf4f29198bb8b6839341e60
4
+ data.tar.gz: af36bbca938916d52d595c5108f5cb39662425de
5
+ SHA512:
6
+ metadata.gz: f67aa3bc2eddfcc3bd4606e9b0dc55ba415e4c643fee14623e6d52be428bdd7749e0c4ab9d80371b336e80880a95212cd17e757500b7ac57bb3c049a6452ebd6
7
+ data.tar.gz: dc9e165f93f9f60ebe66d0292a2a1b2ef8c03a3a66ef9c7e80ff218b6a3080d8e72242df8c594d140f957368fcb7917db0b9376710f959d26ea1401729fb746a
@@ -1,5 +1,5 @@
1
1
  class RedHash
2
- attr_accessor :hash_key, :redis
2
+ attr_accessor :hash_key, :redis, :default
3
3
 
4
4
  def initialize(hash_key = self.class.name, redis = Red.new)
5
5
  self.hash_key = hash_key
@@ -15,7 +15,7 @@ class RedHash
15
15
 
16
16
  def [](key)
17
17
  redis.execute_with_uncertainty(nil) do
18
- redis.hget(hash_key, key)
18
+ redis.hget(hash_key, key) || default
19
19
  end
20
20
  end
21
21
 
@@ -1,4 +1,4 @@
1
1
  module Redness
2
- VERSION="0.2.1"
2
+ VERSION="0.2.2"
3
3
  MAJOR, MINOR, TINY = VERSION.split(".")
4
4
  end
@@ -28,8 +28,10 @@ describe RedHash do
28
28
  red_hash[:key].should == "value"
29
29
  end
30
30
 
31
- it "returns nil if the key does not exist" do
31
+ it "returns the default if the key does not exist" do
32
32
  red_hash[:non_key].should be_nil
33
+ red_hash.default = "foo!"
34
+ red_hash[:non_key].should == "foo!"
33
35
  end
34
36
 
35
37
  it "should get different values depending on hash_key" do
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redness
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
5
- prerelease:
4
+ version: 0.2.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Baldur Gudbjornsson
@@ -14,44 +13,39 @@ authors:
14
13
  autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
- date: 2013-08-28 00:00:00.000000000 Z
16
+ date: 2013-10-21 00:00:00.000000000 Z
18
17
  dependencies:
19
18
  - !ruby/object:Gem::Dependency
20
19
  name: json
21
20
  requirement: !ruby/object:Gem::Requirement
22
- none: false
23
21
  requirements:
24
- - - ! '>='
22
+ - - '>='
25
23
  - !ruby/object:Gem::Version
26
24
  version: '0'
27
25
  type: :runtime
28
26
  prerelease: false
29
27
  version_requirements: !ruby/object:Gem::Requirement
30
- none: false
31
28
  requirements:
32
- - - ! '>='
29
+ - - '>='
33
30
  - !ruby/object:Gem::Version
34
31
  version: '0'
35
32
  - !ruby/object:Gem::Dependency
36
33
  name: rspec
37
34
  requirement: !ruby/object:Gem::Requirement
38
- none: false
39
35
  requirements:
40
- - - ! '>='
36
+ - - '>='
41
37
  - !ruby/object:Gem::Version
42
38
  version: '0'
43
39
  type: :development
44
40
  prerelease: false
45
41
  version_requirements: !ruby/object:Gem::Requirement
46
- none: false
47
42
  requirements:
48
- - - ! '>='
43
+ - - '>='
49
44
  - !ruby/object:Gem::Version
50
45
  version: '0'
51
46
  - !ruby/object:Gem::Dependency
52
47
  name: redis
53
48
  requirement: !ruby/object:Gem::Requirement
54
- none: false
55
49
  requirements:
56
50
  - - ~>
57
51
  - !ruby/object:Gem::Version
@@ -59,7 +53,6 @@ dependencies:
59
53
  type: :runtime
60
54
  prerelease: false
61
55
  version_requirements: !ruby/object:Gem::Requirement
62
- none: false
63
56
  requirements:
64
57
  - - ~>
65
58
  - !ruby/object:Gem::Version
@@ -67,49 +60,43 @@ dependencies:
67
60
  - !ruby/object:Gem::Dependency
68
61
  name: activesupport
69
62
  requirement: !ruby/object:Gem::Requirement
70
- none: false
71
63
  requirements:
72
- - - ! '>='
64
+ - - '>='
73
65
  - !ruby/object:Gem::Version
74
66
  version: '0'
75
67
  type: :runtime
76
68
  prerelease: false
77
69
  version_requirements: !ruby/object:Gem::Requirement
78
- none: false
79
70
  requirements:
80
- - - ! '>='
71
+ - - '>='
81
72
  - !ruby/object:Gem::Version
82
73
  version: '0'
83
74
  - !ruby/object:Gem::Dependency
84
75
  name: timecop
85
76
  requirement: !ruby/object:Gem::Requirement
86
- none: false
87
77
  requirements:
88
- - - ! '>='
78
+ - - '>='
89
79
  - !ruby/object:Gem::Version
90
80
  version: '0'
91
81
  type: :development
92
82
  prerelease: false
93
83
  version_requirements: !ruby/object:Gem::Requirement
94
- none: false
95
84
  requirements:
96
- - - ! '>='
85
+ - - '>='
97
86
  - !ruby/object:Gem::Version
98
87
  version: '0'
99
88
  - !ruby/object:Gem::Dependency
100
89
  name: rake
101
90
  requirement: !ruby/object:Gem::Requirement
102
- none: false
103
91
  requirements:
104
- - - ! '>='
92
+ - - '>='
105
93
  - !ruby/object:Gem::Version
106
94
  version: '0'
107
95
  type: :development
108
96
  prerelease: false
109
97
  version_requirements: !ruby/object:Gem::Requirement
110
- none: false
111
98
  requirements:
112
- - - ! '>='
99
+ - - '>='
113
100
  - !ruby/object:Gem::Version
114
101
  version: '0'
115
102
  description: Helpful Ruby classes for improved Redis data structures
@@ -153,27 +140,26 @@ files:
153
140
  homepage: http://github.com/howaboutwe/redness
154
141
  licenses:
155
142
  - MIT
143
+ metadata: {}
156
144
  post_install_message:
157
145
  rdoc_options: []
158
146
  require_paths:
159
147
  - lib
160
148
  required_ruby_version: !ruby/object:Gem::Requirement
161
- none: false
162
149
  requirements:
163
- - - ! '>='
150
+ - - '>='
164
151
  - !ruby/object:Gem::Version
165
152
  version: '0'
166
153
  required_rubygems_version: !ruby/object:Gem::Requirement
167
- none: false
168
154
  requirements:
169
- - - ! '>='
155
+ - - '>='
170
156
  - !ruby/object:Gem::Version
171
157
  version: '0'
172
158
  requirements: []
173
159
  rubyforge_project:
174
- rubygems_version: 1.8.25
160
+ rubygems_version: 2.1.9
175
161
  signing_key:
176
- specification_version: 3
162
+ specification_version: 4
177
163
  summary: Helpful Ruby classes for improved Redis data structures
178
164
  test_files: []
179
165
  has_rdoc: