Sha256: de253d6a6941eacdb448b0a245af615697a2c048d118179b704ce54e271398c3

Contents?: true

Size: 690 Bytes

Versions: 10

Compression:

Stored size: 690 Bytes

Contents

$partials = {}

def execute_in(env:)
  yield if $env == env
end

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

def partial(name, message: [], &block)
  message         = [message] if message.kind_of?(String)
  before_message  = message[0]
  after_message   = message[1]
  $partials[name] = { block: block, before_message: before_message, after_message: after_message }
end

def print_to_terminal(message, color: nil, newline: true)
  return unless message
  message += "\n" if newline
  message = message.send(color) if color
  $stdout.print message
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
deplomat-0.1.13 lib/deplomat/directives.rb
deplomat-0.1.12 lib/deplomat/directives.rb
deplomat-0.1.11 lib/deplomat/directives.rb
deplomat-0.1.10 lib/deplomat/directives.rb
deplomat-0.1.8 lib/deplomat/directives.rb
deplomat-0.1.7 lib/deplomat/directives.rb
deplomat-0.1.6 lib/deplomat/directives.rb
deplomat-0.1.5 lib/deplomat/directives.rb
deplomat-0.1.3 lib/deplomat/directives.rb
deplomat-0.1.1 lib/deplomat/directives.rb