Class: CircleCI::Parallel::Hook Private

Inherits:
Object
  • Object
show all
Defined in:
lib/circleci/parallel/hook.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(proc = nil, chdir = true) ⇒ Hook

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Hook.



7
8
9
10
# File 'lib/circleci/parallel/hook.rb', line 7

def initialize(proc = nil, chdir = true)
  @proc = proc
  @chdir = chdir
end

Instance Attribute Details

#chdirObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



5
6
7
# File 'lib/circleci/parallel/hook.rb', line 5

def chdir
  @chdir
end

#procObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



5
6
7
# File 'lib/circleci/parallel/hook.rb', line 5

def proc
  @proc
end

Instance Method Details

#call(dir) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



12
13
14
15
16
17
18
19
20
# File 'lib/circleci/parallel/hook.rb', line 12

def call(dir)
  return unless proc

  if chdir
    Dir.chdir(dir, &proc)
  else
    proc.call(dir)
  end
end