ohm 0.0.37 → 0.0.38

Sign up to get free protection for your applications and to get access to all the features.
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.37"
12
+ VERSION = "0.0.38"
13
13
 
14
14
  # Provides access to the Redis database. This is shared accross all models and instances.
15
15
  def redis
@@ -200,7 +200,7 @@ module Ohm
200
200
  Raw = Ohm::Set
201
201
 
202
202
  def inspect
203
- "#<Set (#{model}): #{all.inspect}>"
203
+ "#<Set (#{model}): #{raw.to_a.inspect}>"
204
204
  end
205
205
 
206
206
  # Returns an intersection with the sets generated from the passed hash.
@@ -265,7 +265,7 @@ module Ohm
265
265
  end
266
266
 
267
267
  def inspect
268
- "#<List (#{model}): #{all.inspect}>"
268
+ "#<List (#{model}): #{raw.to_a.inspect}>"
269
269
  end
270
270
  end
271
271
 
@@ -0,0 +1,28 @@
1
+ require File.expand_path("test_helper", File.dirname(__FILE__))
2
+
3
+ class Post < Ohm::Model
4
+ attribute :title
5
+
6
+ list :categories, Category
7
+ end
8
+
9
+ class Category < Ohm::Model
10
+ attribute :name
11
+
12
+ set :posts, Post
13
+ end
14
+
15
+ class CircularReferenceTest < Test::Unit::TestCase
16
+ setup do
17
+ @post = Post.create(:title => "New post")
18
+ @category = Category.create(:name => "Ruby")
19
+ end
20
+
21
+ test "inspect" do
22
+ @post.categories << @category
23
+ @category.posts << @post
24
+
25
+ assert_equal %Q{#<Post:1 title="New post" categories=#<List (Category): ["1"]>>}, @post.inspect
26
+ assert_equal %Q{#<Category:1 name="Ruby" posts=#<Set (Post): ["1"]>>}, @category.inspect
27
+ end
28
+ end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ohm
3
3
  version: !ruby/object:Gem::Version
4
- hash: 85
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 0
9
- - 37
10
- version: 0.0.37
8
+ - 38
9
+ version: 0.0.38
11
10
  platform: ruby
12
11
  authors:
13
12
  - Michel Martens
@@ -16,7 +15,7 @@ autorequire:
16
15
  bindir: bin
17
16
  cert_chain: []
18
17
 
19
- date: 2010-07-07 00:00:00 -03:00
18
+ date: 2010-07-12 00:00:00 -03:00
20
19
  default_executable:
21
20
  dependencies:
22
21
  - !ruby/object:Gem::Dependency
@@ -27,7 +26,6 @@ dependencies:
27
26
  requirements:
28
27
  - - ">="
29
28
  - !ruby/object:Gem::Version
30
- hash: 31
31
29
  segments:
32
30
  - 1
33
31
  - 0
@@ -43,7 +41,6 @@ dependencies:
43
41
  requirements:
44
42
  - - ~>
45
43
  - !ruby/object:Gem::Version
46
- hash: 9
47
44
  segments:
48
45
  - 0
49
46
  - 1
@@ -72,6 +69,7 @@ files:
72
69
  - test/1.8.6_test.rb
73
70
  - test/all_tests.rb
74
71
  - test/benchmarks.rb
72
+ - test/circular_reference_test.rb
75
73
  - test/connection_test.rb
76
74
  - test/errors_test.rb
77
75
  - test/indices_test.rb
@@ -95,7 +93,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
95
93
  requirements:
96
94
  - - ">="
97
95
  - !ruby/object:Gem::Version
98
- hash: 3
99
96
  segments:
100
97
  - 0
101
98
  version: "0"
@@ -104,7 +101,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
101
  requirements:
105
102
  - - ">="
106
103
  - !ruby/object:Gem::Version
107
- hash: 3
108
104
  segments:
109
105
  - 0
110
106
  version: "0"