Class: Hystrix::InlineCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/hystrix/inline.rb

Instance Attribute Summary

Attributes inherited from Command

#circuit, #executor_pool

Instance Method Summary collapse

Methods inherited from Command

default_pool_size, #execute, #executor_pool_name, pool_size, #queue

Constructor Details

#initialize(executor_pool_name, run_block, fallback_block) ⇒ InlineCommand

Returns a new instance of InlineCommand.



29
30
31
32
33
34
# File 'lib/hystrix/inline.rb', line 29

def initialize(executor_pool_name, run_block, fallback_block)
	@run_block = run_block
	@fallback_block = fallback_block
	@executor_pool_name = executor_pool_name
	super
end

Instance Method Details

#fallback(error) ⇒ Object



40
41
42
43
44
45
46
# File 'lib/hystrix/inline.rb', line 40

def fallback(error)
	if @fallback_block
		@fallback_block.yield(error)
	else
		raise NotImplementedError
	end
end

#runObject



36
37
38
# File 'lib/hystrix/inline.rb', line 36

def run
	@run_block.yield
end