module Kamaze::Project::Concern::Cli::WithExitOnFailure

Concern exit on failure

Use “retcode“ to exit in “with_exit_on_failure“ blocks.

@todo Add (rspec) test and examples

Protected Instance Methods

with_exit_on_failure() { |self| ... } click to toggle source

Initiates termination by raising “SystemExit“ exception depending on “success“ of given block.

@yield [Object] @yieldparam [self]

@raise [SystemExit] @return [Object]

# File lib/kamaze/project/concern/cli/with_exit_on_failure.rb, line 29
def with_exit_on_failure
  yield(self).tap { exit(retcode) if failure? }
end