Module: Kamaze::Project::Concern::Cli
- Included in:
- WithExitOnFailure
- Defined in:
- lib/kamaze/project/concern/cli.rb
Overview
Concern for CLI
This module provides base methods focused on retcode
.
Defined Under Namespace
Modules: WithExitOnFailure
Class Method Summary collapse
Instance Method Summary collapse
-
#failure? ⇒ Boolean
(also: #failed?)
Denote execution is a failure.
-
#retcode ⇒ Fixnum
Status code usable to eventually initiates the termination.
-
#success? ⇒ Boolean
(also: #successful?)
Denote execution is a success.
Class Method Details
.included(base) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/kamaze/project/concern/cli.rb', line 21 def included(base) base.class_eval <<-"ACCESSORS", __FILE__, __LINE__ + 1 protected attr_writer :retcode ACCESSORS end |
Instance Method Details
#failure? ⇒ Boolean Also known as: failed?
Denote execution is a failure.
48 49 50 |
# File 'lib/kamaze/project/concern/cli.rb', line 48 def failure? !success? end |
#retcode ⇒ Fixnum
Status code usable to eventually initiates the termination.
33 34 35 |
# File 'lib/kamaze/project/concern/cli.rb', line 33 def retcode @retcode || Errno::NOERROR::Errno end |
#success? ⇒ Boolean Also known as: successful?
Denote execution is a success.
40 41 42 43 |
# File 'lib/kamaze/project/concern/cli.rb', line 40 def success? # noinspection RubyResolve Errno::NOERROR::Errno == retcode end |