Top Level Namespace
Defined Under Namespace
Modules: Deplomat
Instance Method Summary collapse
- #execute_in(env:) ⇒ Object
- #execute_partial(name, args = {}) ⇒ Object
- #partial(name, message: [], &block) ⇒ Object
- #print_to_terminal(message, color: nil, newline: true) ⇒ Object
Instance Method Details
#execute_in(env:) ⇒ Object
3 4 5 |
# File 'lib/deplomat/directives.rb', line 3 def execute_in(env:) yield if $env == env end |
#execute_partial(name, args = {}) ⇒ Object
7 8 9 10 11 |
# File 'lib/deplomat/directives.rb', line 7 def execute_partial(name, args={}) print_to_terminal $partials[name][:before_message] $partials[name][:block].call(args) print_to_terminal $partials[name][:after_message] end |
#partial(name, message: [], &block) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/deplomat/directives.rb', line 13 def partial(name, message: [], &block) = [] if .kind_of?(String) = [0] = [1] $partials[name] = { block: block, before_message: , after_message: } end |
#print_to_terminal(message, color: nil, newline: true) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/deplomat/directives.rb', line 20 def print_to_terminal(, color: nil, newline: true) return unless += "\n" if newline = .send(color) if color $stdout.print end |