Module: Deferable

Included in:
IONe, IONe::PostDeployActivities
Defined in:
service/defer.rb

Overview

Go-lang defer operator realization

Instance Method Summary collapse

Instance Method Details

#defer(&block) ⇒ Object

Note:

Remember to make your method deferable

Defer given block at function  @example How to make method deferable

class YourClass
    include Deferable
    def test_method_with_defer
        defer { puts 'prints this after return' }
        return
    end
    deferable :test_method_with_defer
end


14
15
16
17
# File 'service/defer.rb', line 14

def defer &block
    @defered_methods << block
    true
end