ohm 0.0.35 → 0.0.36
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.
- data/Rakefile +10 -2
- data/lib/ohm.rb +10 -2
- data/test/model_test.rb +2 -2
- data/test/wrapper_test.rb +20 -0
- metadata +9 -4
data/Rakefile
CHANGED
@@ -24,6 +24,14 @@ task :stop do
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
|
28
|
-
|
27
|
+
task :test do
|
28
|
+
Dir["test/**/*_test.rb"].each do |file|
|
29
|
+
fork do
|
30
|
+
load file
|
31
|
+
end
|
32
|
+
|
33
|
+
Process.wait
|
34
|
+
|
35
|
+
exit $?.exitstatus unless $?.success?
|
36
|
+
end
|
29
37
|
end
|
data/lib/ohm.rb
CHANGED
@@ -9,7 +9,7 @@ require File.join(File.dirname(__FILE__), "ohm", "key")
|
|
9
9
|
require File.join(File.dirname(__FILE__), "ohm", "collection")
|
10
10
|
|
11
11
|
module Ohm
|
12
|
-
VERSION = "0.0.
|
12
|
+
VERSION = "0.0.36"
|
13
13
|
|
14
14
|
# Provides access to the Redis database. This is shared accross all models and instances.
|
15
15
|
def redis
|
@@ -706,7 +706,15 @@ module Ohm
|
|
706
706
|
end
|
707
707
|
|
708
708
|
def self.const_missing(name)
|
709
|
-
Wrapper.new(name) { const_get(name) }
|
709
|
+
wrapper = Wrapper.new(name) { const_get(name) }
|
710
|
+
|
711
|
+
# Allow others to hook to const_missing.
|
712
|
+
begin
|
713
|
+
super(name)
|
714
|
+
rescue NameError
|
715
|
+
end
|
716
|
+
|
717
|
+
wrapper
|
710
718
|
end
|
711
719
|
|
712
720
|
private
|
data/test/model_test.rb
CHANGED
@@ -916,8 +916,8 @@ class TestRedis < Test::Unit::TestCase
|
|
916
916
|
car = Car.create(:name => "Twingo")
|
917
917
|
make = Make.create(:name => "Renault")
|
918
918
|
|
919
|
-
assert_equal 1, Make.db.instance_variable_get("@db")
|
920
|
-
assert_equal 2, Car.db.instance_variable_get("@db")
|
919
|
+
assert_equal 1, Make.db.client.instance_variable_get("@db")
|
920
|
+
assert_equal 2, Car.db.client.instance_variable_get("@db")
|
921
921
|
|
922
922
|
assert_equal car, Car[1]
|
923
923
|
assert_equal make, Make[1]
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "test_helper"))
|
2
|
+
|
3
|
+
$missing_constants = []
|
4
|
+
|
5
|
+
class Object
|
6
|
+
def self.const_missing(name)
|
7
|
+
$missing_constants << name
|
8
|
+
super(name)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class Foo < Ohm::Model
|
13
|
+
set :bars, Bar
|
14
|
+
end
|
15
|
+
|
16
|
+
class Tests < Test::Unit::TestCase
|
17
|
+
test "calls other const_missing hooks" do
|
18
|
+
assert_equal [:Bar], $missing_constants
|
19
|
+
end
|
20
|
+
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 36
|
9
|
+
version: 0.0.36
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Michel Martens
|
@@ -15,13 +15,14 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-07-02 00:00:00 -03:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: redis
|
23
23
|
prerelease: false
|
24
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
25
26
|
requirements:
|
26
27
|
- - ">="
|
27
28
|
- !ruby/object:Gem::Version
|
@@ -36,6 +37,7 @@ dependencies:
|
|
36
37
|
name: contest
|
37
38
|
prerelease: false
|
38
39
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
39
41
|
requirements:
|
40
42
|
- - ~>
|
41
43
|
- !ruby/object:Gem::Version
|
@@ -74,6 +76,7 @@ files:
|
|
74
76
|
- test/mutex_test.rb
|
75
77
|
- test/test_helper.rb
|
76
78
|
- test/validations_test.rb
|
79
|
+
- test/wrapper_test.rb
|
77
80
|
- test/test.conf
|
78
81
|
has_rdoc: true
|
79
82
|
homepage: http://github.com/soveran/ohm
|
@@ -85,6 +88,7 @@ rdoc_options: []
|
|
85
88
|
require_paths:
|
86
89
|
- lib
|
87
90
|
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
88
92
|
requirements:
|
89
93
|
- - ">="
|
90
94
|
- !ruby/object:Gem::Version
|
@@ -92,6 +96,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
92
96
|
- 0
|
93
97
|
version: "0"
|
94
98
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
|
+
none: false
|
95
100
|
requirements:
|
96
101
|
- - ">="
|
97
102
|
- !ruby/object:Gem::Version
|
@@ -101,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
106
|
requirements: []
|
102
107
|
|
103
108
|
rubyforge_project: ohm
|
104
|
-
rubygems_version: 1.3.
|
109
|
+
rubygems_version: 1.3.7
|
105
110
|
signing_key:
|
106
111
|
specification_version: 3
|
107
112
|
summary: Object-hash mapping library for Redis.
|