platanus 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,6 +22,10 @@ module Platanus
22
22
  to_cache_prf = if _options[:cache_prf].nil? then 'last_' else _options.delete(:cache_prf) end
23
23
  stack_key = if _options[:stack_key].nil? then 'created_at DESC, id DESC' else _options.delete(:stack_key) end
24
24
 
25
+ # Retrieve callbacks
26
+ before_push = _options.delete(:before_push)
27
+ after_push = _options.delete(:after_push)
28
+
25
29
  _options[:order] = stack_key
26
30
  _options[:limit] = 10 if _options[:limit].nil?
27
31
 
@@ -39,7 +43,7 @@ module Platanus
39
43
  self.class.transaction do
40
44
 
41
45
  # Execute before callbacks
42
- self.send(_options[:before_push], obj) if _options.has_key? :before_push
46
+ self.send(before_push, obj) unless before_push.nil?
43
47
  block.call(self, obj) unless block.nil?
44
48
 
45
49
  # Cache required fields
@@ -53,7 +57,7 @@ module Platanus
53
57
  @_stacked_last = obj
54
58
 
55
59
  # Execute after callback
56
- self.send(_options[:after_push], obj) if _options.has_key? :after_push
60
+ self.send(after_push, obj) unless after_push.nil?
57
61
  end
58
62
  end
59
63
 
@@ -1,3 +1,3 @@
1
1
  module Platanus
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: platanus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
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-07-19 00:00:00.000000000 Z
12
+ date: 2012-07-20 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Platan.us utility gem
15
15
  email: