poro 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -160,6 +160,10 @@ mailto:jeff@paploo.net
160
160
 
161
161
  = Version History
162
162
 
163
+ [0.1.4 - 2010-Nov-08] Bug Fixes.
164
+ * MongoContext: Fixed broken fetch method.
165
+ * HashContext: Fixed crash on find without a conditions hash.
166
+ * Minor gemspec file change for compatibility with bundler.
163
167
  [0.1.3 - 2010-Oct-21] Callbacks and MongoContext Bug Fixes.
164
168
  * Added callbacks for common events.
165
169
  * MongoContext: You can actually remove records now.
@@ -88,7 +88,7 @@ module Poro
88
88
  # If a search condition is the primary key, we can significantly limit our work.
89
89
  values = nil
90
90
  data = nil
91
- if( opts[:conditions].has_key?( self.primary_key ) )
91
+ if( opts[:conditions] && opts[:conditions].has_key?( self.primary_key ) )
92
92
  pk_value = opts[:conditions].delete(self.primary_key)
93
93
  obj = self.fetch( pk_value )
94
94
  values = obj.nil? ? [] : [obj]
@@ -152,9 +152,9 @@ module Poro
152
152
 
153
153
  # Filters out records that, for each of the conditions in the hash,
154
154
  # have a value at the keypath and the value at that keypath matches the
155
- # desired value.
155
+ # desired value, and returns them.
156
156
  def filter(data, conditions_opt)
157
- conditions_opt.inject(data) do |matches,(key, value)|
157
+ (conditions_opt||{}).inject(data) do |matches,(key, value)|
158
158
  keypath = key.to_s.split('.')
159
159
  matches.select do |record|
160
160
  value_info = value_for_key(record, keypath)
@@ -91,8 +91,8 @@ module Poro
91
91
 
92
92
  def fetch(id)
93
93
  data = data_store.find_one( clean_id(id) )
94
- obj convert_to_plain_object(data)
95
- callback_event(:before_fetch, obj)
94
+ obj = convert_to_plain_object(data)
95
+ callback_event(:after_fetch, obj)
96
96
  return obj
97
97
  end
98
98
 
@@ -3,5 +3,5 @@
3
3
  # existing plain ol' ruby objects as little as possible. For more information
4
4
  # see README.rdoc.
5
5
  module Poro
6
- VERSION = '0.1.3'
6
+ VERSION = '0.1.4'
7
7
  end
@@ -227,6 +227,12 @@ describe "HashContext" do
227
227
  @context.send(:value_for_key, record, :id)[:value].should == 3
228
228
  end
229
229
 
230
+ it 'should find first without opts' do
231
+ record = @context.find(:first)
232
+ record.should_not be_nil
233
+ @context.send(:value_for_key, record, :id)[:value].should == 1
234
+ end
235
+
230
236
  end
231
237
 
232
238
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 3
9
- version: 0.1.3
8
+ - 4
9
+ version: 0.1.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jeff Reinecke
@@ -14,11 +14,11 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-10-21 00:00:00 -07:00
17
+ date: 2010-11-08 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
21
- description: " Plain Ol' Ruby Objects (PORO) is a thing and lightweight persistence engine\n that can use nearly any persistence store. Its purpose is to allow you to\n easily add a persistence store to your existing objects in an application.\n"
21
+ description: " Plain Ol' Ruby Objects (PORO) is a persistence engine that can use nearly\n any persistence store. Its purpose is to allow you to easily add a\n persistence store to your existing objects in an application. Currently,\n there is support for MongoDB, though SQL and Memcache support is planned.\n"
22
22
  email: jeff@paploo.net
23
23
  executables: []
24
24
 
@@ -93,6 +93,6 @@ rubyforge_project:
93
93
  rubygems_version: 1.3.7
94
94
  signing_key:
95
95
  specification_version: 3
96
- summary: A lightweight thin persistence engine that can utilize many different persistence data stores.
96
+ summary: Persistence of Plain Ol' Ruby Objects in MongoDB, Memory, and eventually SQL and Memcache.
97
97
  test_files: []
98
98