Class: ShellIfContext
- Inherits:
-
Object
- Object
- ShellIfContext
- Includes:
- Stuff::ApiBehaviour
- Defined in:
- lib/cabeza-de-termo/cachivache-helpers/utilities/shell-if-context.rb
Class Method Summary collapse
Instance Method Summary collapse
- #evaluate_with(block) ⇒ Object
-
#initialize(args) ⇒ ShellIfContext
constructor
A new instance of ShellIfContext.
Methods included from Stuff::ApiBehaviour
#configure, #execute, #in_file, #invoke, #raise_validation_error, #remind_to, #shell, #shell!, #shell_context, #shell_unless
Constructor Details
#initialize(args) ⇒ ShellIfContext
Returns a new instance of ShellIfContext.
10 11 12 |
# File 'lib/cabeza-de-termo/cachivache-helpers/utilities/shell-if-context.rb', line 10 def initialize(args) @guard = args[:guard] end |
Class Method Details
.with(args, &block) ⇒ Object
6 7 8 |
# File 'lib/cabeza-de-termo/cachivache-helpers/utilities/shell-if-context.rb', line 6 def self.with(args, &block) new(args).evaluate_with block end |
Instance Method Details
#evaluate_with(block) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/cabeza-de-termo/cachivache-helpers/utilities/shell-if-context.rb', line 14 def evaluate_with(block) shell "if #{@guard}; then" instance_eval(&block) shell "fi" end |