Class: Dir

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

Overview

Copyright 2011 Tommy Poulter

This file is part of basechip.

basechip is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation.

basechip is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with basechip. If not, see <www.gnu.org/licenses/>.

Constant Summary collapse

@@pushd_stack =
[]

Class Method Summary collapse

Class Method Details

.popdObject



23
24
25
26
27
28
29
# File 'lib/dir.rb', line 23

def self.popd
  if d = @@pushd_stack.pop
    Dir.chdir d
  else
    raise "directory stack empty, pwd = #{Dir.pwd}"
  end
end

.pushd(d) ⇒ Object



19
20
21
22
# File 'lib/dir.rb', line 19

def self.pushd(d)
  @@pushd_stack << Dir.pwd
  Dir.chdir d
end