Method: Terminitor::Dsl#before

Defined in:
lib/terminitor/dsl.rb

#before(*commands, &block) ⇒ Object

runs commands before each tab in window context

Examples:

window do
  before { run 'whoami' }
end

Parameters:

  • Array (Array<String>)

    of commands

  • (Proc)


67
68
69
70
71
72
73
74
# File 'lib/terminitor/dsl.rb', line 67

def before(*commands, &block)
  @_context[:before] ||= []
  if block_given?
    in_context @_context[:before], &block
  else
    @_context[:before].concat(commands)
  end
end