ohm 0.1.0.rc1 → 0.1.0.rc2

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,6 @@ 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.1.0.rc1"
13
12
 
14
13
  # Provides access to the Redis database. This is shared accross all models and instances.
15
14
  def redis
@@ -553,6 +552,7 @@ module Ohm
553
552
  #
554
553
  # assert_equal [event1], Event.find(author: "Albert", day: "2009-09-09")
555
554
  def self.find(hash)
555
+ raise ArgumentError, "You need to supply a hash with filters. If you want to find by ID, use #{self}[id] instead." unless hash.kind_of?(Hash)
556
556
  all.find(hash)
557
557
  end
558
558
 
@@ -695,7 +695,7 @@ module Ohm
695
695
 
696
696
  def write
697
697
  unless attributes.empty?
698
- attributes.each_with_index do |att, index|
698
+ attributes.each do |att|
699
699
  value = send(att).to_s
700
700
 
701
701
  if value.empty?
@@ -0,0 +1,5 @@
1
+ # encoding: UTF-8
2
+
3
+ module Ohm
4
+ VERSION = "0.1.0.rc2"
5
+ end
data/test/indices_test.rb CHANGED
@@ -42,6 +42,12 @@ class IndicesTest < Test::Unit::TestCase
42
42
  assert_equal @user1, User.find(:email => "foo").first
43
43
  end
44
44
 
45
+ should "raise an error if the parameter supplied is not a hash" do
46
+ assert_raises ArgumentError.new("You need to supply a hash with filters. If you want to find by ID, use IndicesTest::User[id] instead.") do
47
+ User.find(1)
48
+ end
49
+ end
50
+
45
51
  should "avoid intersections with the all collection" do
46
52
  assert_equal "IndicesTest::User:email:#{Ohm::Model.encode "foo"}", User.find(:email => "foo").key.to_s
47
53
 
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ohm
3
3
  version: !ruby/object:Gem::Version
4
- hash: 176182720
5
4
  prerelease: true
6
5
  segments:
7
6
  - 0
8
7
  - 1
9
8
  - 0
10
- - rc1
11
- version: 0.1.0.rc1
9
+ - rc2
10
+ version: 0.1.0.rc2
12
11
  platform: ruby
13
12
  authors:
14
13
  - Michel Martens
@@ -17,40 +16,51 @@ autorequire:
17
16
  bindir: bin
18
17
  cert_chain: []
19
18
 
20
- date: 2010-05-10 00:00:00 -03:00
19
+ date: 2010-05-12 00:00:00 -03:00
21
20
  default_executable:
22
21
  dependencies:
23
22
  - !ruby/object:Gem::Dependency
24
23
  name: redis
25
24
  prerelease: false
26
25
  requirement: &id001 !ruby/object:Gem::Requirement
27
- none: false
28
26
  requirements:
29
27
  - - ">="
30
28
  - !ruby/object:Gem::Version
31
- hash: 31
32
29
  segments:
33
- - 1
30
+ - 2
31
+ - 0
34
32
  - 0
35
- - 4
36
- version: 1.0.4
33
+ - rc3
34
+ version: 2.0.0.rc3
37
35
  type: :runtime
38
36
  version_requirements: *id001
39
37
  - !ruby/object:Gem::Dependency
40
38
  name: contest
41
39
  prerelease: false
42
40
  requirement: &id002 !ruby/object:Gem::Requirement
43
- none: false
44
41
  requirements:
45
42
  - - ~>
46
43
  - !ruby/object:Gem::Version
47
- hash: 9
48
44
  segments:
49
45
  - 0
50
46
  - 1
51
47
  version: "0.1"
52
48
  type: :development
53
49
  version_requirements: *id002
50
+ - !ruby/object:Gem::Dependency
51
+ name: batch
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ~>
56
+ - !ruby/object:Gem::Version
57
+ segments:
58
+ - 0
59
+ - 0
60
+ - 1
61
+ version: 0.0.1
62
+ type: :development
63
+ version_requirements: *id003
54
64
  description: Ohm is a library that allows to store an object in Redis, a persistent key-value database. It includes an extensible list of validations and has very good performance.
55
65
  email:
56
66
  - michel@soveran.com
@@ -67,6 +77,7 @@ files:
67
77
  - lib/ohm/key.rb
68
78
  - lib/ohm/utils/upgrade.rb
69
79
  - lib/ohm/validations.rb
80
+ - lib/ohm/version.rb
70
81
  - lib/ohm.rb
71
82
  - README.markdown
72
83
  - LICENSE
@@ -93,20 +104,16 @@ rdoc_options: []
93
104
  require_paths:
94
105
  - lib
95
106
  required_ruby_version: !ruby/object:Gem::Requirement
96
- none: false
97
107
  requirements:
98
108
  - - ">="
99
109
  - !ruby/object:Gem::Version
100
- hash: 3
101
110
  segments:
102
111
  - 0
103
112
  version: "0"
104
113
  required_rubygems_version: !ruby/object:Gem::Requirement
105
- none: false
106
114
  requirements:
107
115
  - - ">"
108
116
  - !ruby/object:Gem::Version
109
- hash: 25
110
117
  segments:
111
118
  - 1
112
119
  - 3
@@ -115,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
122
  requirements: []
116
123
 
117
124
  rubyforge_project: ohm
118
- rubygems_version: 1.3.7.pre.1
125
+ rubygems_version: 1.3.6
119
126
  signing_key:
120
127
  specification_version: 3
121
128
  summary: Object-hash mapping library for Redis.