class RetryingTsquery
Inspired by rubytapas.dpdcart.com/subscriber/post?id=689
Public Instance Methods
connect(times: 3, sleep: Kernel.method(:sleep), **keyword_args)
click to toggle source
Calls superclass method
# File lib/retrying_tsquery.rb, line 7 def connect(times: 3, sleep: Kernel.method(:sleep), **keyword_args) super(**keyword_args) rescue Errno::ECONNREFUSED sleep.call 0.5 retry if (times -= 1) > 0 Kernel.raise end
execute(*args, times: 3, sleep: Kernel.method(:sleep), **keyword_args)
click to toggle source
Calls superclass method
# File lib/retrying_tsquery.rb, line 16 def execute(*args, times: 3, sleep: Kernel.method(:sleep), **keyword_args) super(*args, **keyword_args) rescue Tsquery::UnknownCommand Kernel.raise rescue Tsquery::Error sleep.call 0.5 retry if (times -= 1) > 0 Kernel.raise end
inspect()
click to toggle source
# File lib/retrying_tsquery.rb, line 40 def inspect __getobj__.inspect end
method_missing(command, *args)
click to toggle source
Needed for the delegation to work.
# File lib/retrying_tsquery.rb, line 30 def method_missing(command, *args) execute(command.to_s, *args) end
respond_to_missing?(command, *)
click to toggle source
# File lib/retrying_tsquery.rb, line 35 def respond_to_missing?(command, *) !!(command =~ /[[:alnum:]]$/) end