populate-me 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -31,10 +31,12 @@ module PopulateMe
31
31
  {'_id'=>id}
32
32
  end
33
33
  def find(selector={},opts={})
34
+ selector.update(opts.delete(:selector)||{})
34
35
  opts = {:sort=>self.sorting_order}.update(opts)
35
36
  collection.find(selector,opts).extend(CursorMutation)
36
37
  end
37
38
  def find_one(spec_or_object_id=nil,opts={})
39
+ spec_or_object_id.nil? ? spec_or_object_id = opts.delete(:selector) : spec_or_object_id.update(opts.delete(:selector)||{})
38
40
  opts = {:sort=>self.sorting_order}.update(opts)
39
41
  item = collection.find_one(spec_or_object_id,opts)
40
42
  item.nil? ? nil : self.new(item)
@@ -70,7 +72,11 @@ module PopulateMe
70
72
  end
71
73
 
72
74
  private
73
- def slot(name,opts={}); @schema[name] = {:type=>:string}.update(opts); end
75
+ def slot(name,opts={})
76
+ @schema[name] = {:type=>:string}.update(opts)
77
+ define_method(name) { @doc[name] }
78
+ define_method("#{name}=") { |x| @doc[name] = x }
79
+ end
74
80
  def image_slot(name='image',opts={})
75
81
  slot name, {:type=>:attachment}.update(opts)
76
82
  slot "#{name}_tooltip"
@@ -263,4 +269,4 @@ module PopulateMe
263
269
 
264
270
  end
265
271
  end
266
- end
272
+ end
data/populate-me.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'populate-me'
3
- s.version = "0.0.4"
3
+ s.version = "0.0.5"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.summary = "ALPHA !!! Populate Me is relatively complete but simple CMS"
6
6
  s.description = "ALPHA !!! Populate Me is relatively complete but simple CMS. It includes a Rack middleware for putting in your Rack stack, and a bespoke MongoDB ODM. But Populate Me is not really finished yet."
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: populate-me
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-07 00:00:00.000000000 Z
12
+ date: 2012-10-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack-golem