Commit 0edde7e2661ecdda53fea0ad87db7a750b594742
1 parent
f51492aa
Exists in
master
and in
21 other branches
Cleaner callback code
Showing
1 changed file
with
5 additions
and
5 deletions
Show diff stats
lib/searchkick.rb
... | ... | @@ -18,9 +18,11 @@ module Searchkick |
18 | 18 | class InvalidQueryError < Elasticsearch::Transport::Transport::Errors::BadRequest; end |
19 | 19 | |
20 | 20 | class << self |
21 | + attr_accessor :callbacks | |
21 | 22 | attr_accessor :search_method_name |
22 | 23 | attr_accessor :wordnet_path |
23 | 24 | end |
25 | + self.callbacks = true | |
24 | 26 | self.search_method_name = :search |
25 | 27 | self.wordnet_path = "/var/lib/wn_s.pl" |
26 | 28 | |
... | ... | @@ -36,18 +38,16 @@ module Searchkick |
36 | 38 | @server_version ||= client.info["version"]["number"] |
37 | 39 | end |
38 | 40 | |
39 | - @callbacks = true | |
40 | - | |
41 | 41 | def self.enable_callbacks |
42 | - @callbacks = true | |
42 | + self.callbacks = true | |
43 | 43 | end |
44 | 44 | |
45 | 45 | def self.disable_callbacks |
46 | - @callbacks = false | |
46 | + self.callbacks = false | |
47 | 47 | end |
48 | 48 | |
49 | 49 | def self.callbacks? |
50 | - @callbacks | |
50 | + callbacks | |
51 | 51 | end |
52 | 52 | end |
53 | 53 | ... | ... |