elastic_searchable 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.5
1
+ 0.1.6
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{elastic_searchable}
8
- s.version = "0.1.5"
8
+ s.version = "0.1.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ryan Sonnek"]
@@ -51,24 +51,23 @@ module ElasticSearchable
51
51
  self.run_callbacks(:after_index)
52
52
  end
53
53
  def should_index?
54
- [self.class.elastic_options[:if]].flatten.compact.all? { |a| evaluate_method(a, *args) } &&
55
- ![self.class.elastic_options[:unless]].flatten.compact.any? { |a| evaluate_method(a, *args) }
54
+ [self.class.elastic_options[:if]].flatten.compact.all? { |m| evaluate_condition(m) } &&
55
+ ![self.class.elastic_options[:unless]].flatten.compact.any? { |m| evaluate_condition(m) }
56
56
  end
57
57
 
58
58
  private
59
59
  #ripped from activesupport
60
- def evaluate_method(method, *args, &block)
60
+ def evaluate_condition(method)
61
61
  case method
62
62
  when Symbol
63
- object = args.shift
64
- object.send(method, *args, &block)
63
+ self.send method
65
64
  when String
66
- eval(method, args.first.instance_eval { binding })
65
+ eval(method, self.instance_eval { binding })
67
66
  when Proc, Method
68
- method.call(*args, &block)
67
+ method.call
69
68
  else
70
69
  if method.respond_to?(kind)
71
- method.send(kind, *args, &block)
70
+ method.send kind
72
71
  else
73
72
  raise ArgumentError,
74
73
  "Callbacks must be a symbol denoting the method to call, a string to be evaluated, " +
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastic_searchable
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 5
10
- version: 0.1.5
9
+ - 6
10
+ version: 0.1.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Sonnek