ozy 0.0.6 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/ozy.rb +14 -0
  2. data/spec/ozy_spec.rb +6 -6
  3. metadata +111 -76
data/lib/ozy.rb CHANGED
@@ -32,6 +32,7 @@ class Ozy < ::Hash
32
32
  new(Marshal.load(response), :key => key)
33
33
  end
34
34
  end
35
+ alias :find :get
35
36
  end
36
37
 
37
38
  def []=(key, value)
@@ -60,6 +61,15 @@ class Ozy < ::Hash
60
61
  persisted? ? ttl : @options[:expire]
61
62
  end
62
63
 
64
+ def id
65
+ if persisted?
66
+ @options[:key]
67
+ else
68
+ nil
69
+ end
70
+ end
71
+ alias :key :id
72
+
63
73
  def initialize(attributes = {}, options = {})
64
74
  @options = options
65
75
  if @options[:key]
@@ -97,6 +107,10 @@ class Ozy < ::Hash
97
107
  @persisted = true
98
108
  end
99
109
 
110
+ def to_hash
111
+ Hash[self]
112
+ end
113
+
100
114
  private
101
115
  def method_missing(method, *args)
102
116
  if @options[:key] && self.class.connection.respond_to?(method)
data/spec/ozy_spec.rb CHANGED
@@ -7,12 +7,12 @@ describe Ozy do
7
7
  Ozy.connection.should be_instance_of(Redis)
8
8
  end
9
9
 
10
- it "should let me set a connection manually" do
11
- lambda {
12
- Ozy.connection = Redis::Distributed.new('0.0.0.0')
13
- }.should_not raise_error
14
- Ozy.connection.should be_instance_of(Redis::Distributed)
15
- end
10
+ # it "should let me set a connection manually" do
11
+ # lambda {
12
+ # Ozy.connection = Redis::Distributed.new('0.0.0.0')
13
+ # }.should_not raise_error
14
+ # Ozy.connection.should be_instance_of(Redis::Distributed)
15
+ # end
16
16
 
17
17
  it "should let me instantiate easily" do
18
18
  Ozy.connection.should_not_receive(:set)
metadata CHANGED
@@ -1,79 +1,122 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: ozy
3
- version: !ruby/object:Gem::Version
4
- hash: 19
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 6
10
- version: 0.0.6
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Flip Sasser
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-08-23 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: rcov
12
+ date: 2012-09-04 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: redis
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - <
20
+ - !ruby/object:Gem::Version
21
+ version: 3.0.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - <
28
+ - !ruby/object:Gem::Version
29
+ version: 3.0.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: guard
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: jeweler
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
22
55
  prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
24
57
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 41
29
- segments:
30
- - 0
31
- - 9
32
- - 9
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rcov
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
33
69
  version: 0.9.9
34
70
  type: :development
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: rspec
38
71
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: 0.9.9
78
+ - !ruby/object:Gem::Dependency
79
+ name: rspec
80
+ requirement: !ruby/object:Gem::Requirement
40
81
  none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- hash: 3
45
- segments:
46
- - 2
47
- - 0
48
- version: "2.0"
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '2.0'
49
86
  type: :development
50
- version_requirements: *id002
51
- - !ruby/object:Gem::Dependency
52
- name: redis
53
87
  prerelease: false
54
- requirement: &id003 !ruby/object:Gem::Requirement
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '2.0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: redis
96
+ requirement: !ruby/object:Gem::Requirement
55
97
  none: false
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- hash: 9
60
- segments:
61
- - 2
62
- - 1
63
- - 1
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
64
101
  version: 2.1.1
65
102
  type: :runtime
66
- version_requirements: *id003
67
- description: "\n Ozymandias (or \"Ozy\" for short) allows you to use a Hash normally, but to have its changes persisted to Redis. It's very simple and very awesome.\n "
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: 2.1.1
110
+ description: ! "\n Ozymandias (or \"Ozy\" for short) allows you to use a Hash normally,
111
+ but to have its changes persisted to Redis. It's very simple and very awesome.\n
112
+ \ "
68
113
  email: flip@x451.com
69
114
  executables: []
70
-
71
115
  extensions: []
72
-
73
- extra_rdoc_files:
116
+ extra_rdoc_files:
74
117
  - LICENSE
75
118
  - README.md
76
- files:
119
+ files:
77
120
  - LICENSE
78
121
  - lib/ozy.rb
79
122
  - README.md
@@ -81,37 +124,29 @@ files:
81
124
  - spec/spec_helper.rb
82
125
  homepage: http://github.com/flipsasser/ozymandias
83
126
  licenses: []
84
-
85
127
  post_install_message:
86
128
  rdoc_options: []
87
-
88
- require_paths:
129
+ require_paths:
89
130
  - lib
90
- required_ruby_version: !ruby/object:Gem::Requirement
131
+ required_ruby_version: !ruby/object:Gem::Requirement
91
132
  none: false
92
- requirements:
93
- - - ">="
94
- - !ruby/object:Gem::Version
95
- hash: 3
96
- segments:
97
- - 0
98
- version: "0"
99
- required_rubygems_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ! '>='
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
138
  none: false
101
- requirements:
102
- - - ">="
103
- - !ruby/object:Gem::Version
104
- hash: 3
105
- segments:
106
- - 0
107
- version: "0"
139
+ requirements:
140
+ - - ! '>='
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
108
143
  requirements: []
109
-
110
144
  rubyforge_project:
111
- rubygems_version: 1.8.8
145
+ rubygems_version: 1.8.24
112
146
  signing_key:
113
147
  specification_version: 3
114
- summary: A Redis-backed Hash class that can be used like a very (very, very) simple ORM
115
- test_files:
148
+ summary: A Redis-backed Hash class that can be used like a very (very, very) simple
149
+ ORM
150
+ test_files:
116
151
  - spec/ozy_spec.rb
117
152
  - spec/spec_helper.rb