Class: Hystrix::InlineDSL
- Inherits:
-
Object
- Object
- Hystrix::InlineDSL
- Defined in:
- lib/hystrix/inline.rb
Instance Method Summary collapse
- #execute(&block) ⇒ Object
- #fallback(&block) ⇒ Object
-
#initialize(executor_pool_name = nil) ⇒ InlineDSL
constructor
A new instance of InlineDSL.
- #queue(&block) ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(executor_pool_name = nil) ⇒ InlineDSL
Returns a new instance of InlineDSL.
3 4 5 6 |
# File 'lib/hystrix/inline.rb', line 3 def initialize(executor_pool_name = nil) @executor_pool_name = executor_pool_name @mode = :execute end |
Instance Method Details
#execute(&block) ⇒ Object
8 9 10 11 |
# File 'lib/hystrix/inline.rb', line 8 def execute(&block) @mode = :execute @run_block = block end |
#fallback(&block) ⇒ Object
18 19 20 |
# File 'lib/hystrix/inline.rb', line 18 def fallback(&block) @fallback_block = block end |
#queue(&block) ⇒ Object
13 14 15 16 |
# File 'lib/hystrix/inline.rb', line 13 def queue(&block) @mode = :queue @run_block = block end |
#run ⇒ Object
22 23 24 25 |
# File 'lib/hystrix/inline.rb', line 22 def run cmd = InlineCommand.new(@executor_pool_name, @run_block, @fallback_block) cmd.send(@mode) end |