Class: Komenda::ProcessBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/komenda/process_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command, options = {}) ⇒ ProcessBuilder

Returns a new instance of ProcessBuilder.

Parameters:

  • command (String, String[])
  • options (Hash) (defaults to: {})


10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/komenda/process_builder.rb', line 10

def initialize(command, options = {})
  defaults = {
    env: ENV.to_hash,
    cwd: nil,
    events: {}
  }
  options = defaults.merge(options)

  self.command = command
  self.env = options[:env]
  self.cwd = options[:cwd]
  self.events = options[:events]
end

Instance Attribute Details

#commandObject

Returns the value of attribute command.



3
4
5
# File 'lib/komenda/process_builder.rb', line 3

def command
  @command
end

#cwdObject

Returns the value of attribute cwd.



5
6
7
# File 'lib/komenda/process_builder.rb', line 5

def cwd
  @cwd
end

#envObject

Returns the value of attribute env.



4
5
6
# File 'lib/komenda/process_builder.rb', line 4

def env
  @env
end

#eventsObject

Returns the value of attribute events.



6
7
8
# File 'lib/komenda/process_builder.rb', line 6

def events
  @events
end

Instance Method Details

#createKomenda::Process

Returns:



25
26
27
# File 'lib/komenda/process_builder.rb', line 25

def create
  Komenda::Process.new(self)
end