beanstalker 0.4.13 → 0.4.14

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.13
1
+ 0.4.14
data/beanstalker.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{beanstalker}
8
- s.version = "0.4.13"
8
+ s.version = "0.4.14"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Gleb Pomykalov"]
@@ -33,16 +33,23 @@ module Beanstalker::Extensions
33
33
  @@methods_async_options = {}
34
34
  receiver.extend(ClassMethods)
35
35
  end
36
-
36
+
37
37
  module ClassMethods
38
38
  def async_method(method, options = {})
39
- methods_async_options = class_variable_get(:@@methods_async_options)
39
+ @methods_async_options ||= {}
40
+ if options
41
+ @methods_async_options.merge!(method.to_sym => options)
42
+ end
43
+ end
44
+
45
+ def async_class_method(method, options = {})
46
+ @class_methods_async_options ||= {}
40
47
  if options
41
- class_variable_set(:@@methods_async_options, methods_async_options.merge(method.to_sym => options))
48
+ @class_methods_async_options.merge!(method.to_sym => options)
42
49
  end
43
50
  end
44
51
  end
45
-
52
+
46
53
  def interpolate_async_options(options, object, *args)
47
54
  result = {}
48
55
  options.each do |k,v|
@@ -54,9 +61,14 @@ module Beanstalker::Extensions
54
61
  end
55
62
  result
56
63
  end
57
-
64
+
58
65
  def async_send(selector, *args)
59
- async_send_opts(selector, @@methods_async_options[selector.to_sym] || {}, *args)
66
+ if self.is_a?(Class)
67
+ methods_async_options = self.send(:instance_variable_get, :@class_methods_async_options) || {}
68
+ else
69
+ methods_async_options = self.class.send(:instance_variable_get, :@methods_async_options) || {}
70
+ end
71
+ async_send_opts(selector, methods_async_options[selector.to_sym] || {}, *args)
60
72
  end
61
73
 
62
74
  def async_send_opts(selector, opts, *args)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beanstalker
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 13
10
- version: 0.4.13
9
+ - 14
10
+ version: 0.4.14
11
11
  platform: ruby
12
12
  authors:
13
13
  - Gleb Pomykalov