Class: Monolith::LoggedChdir

Inherits:
Object
  • Object
show all
Includes:
Logger
Defined in:
lib/monolith/logged_chdir.rb

Instance Method Summary collapse

Methods included from Logger

#log

Constructor Details

#initialize(dir) ⇒ LoggedChdir

Returns a new instance of LoggedChdir.



5
6
7
# File 'lib/monolith/logged_chdir.rb', line 5

def initialize(dir)
  @dir = dir
end

Instance Method Details

#chdir(&block) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/monolith/logged_chdir.rb', line 9

def chdir(&block)
  return_value = nil

  Dir.chdir(@dir) do
    log("cd #{@dir}")
    return_value = yield
    log("cd -")
  end

  return_value
end