Class: Dir

Inherits:
Object show all
Defined in:
opal/opal/corelib/dir.rb

Class Method Summary collapse

Class Method Details

.chdir(dir) ⇒ Object


3
4
5
6
7
8
9
# File 'opal/opal/corelib/dir.rb', line 3

def chdir(dir)
  prev_cwd = `Opal.current_dir`
  `Opal.current_dir = #{dir}`
  yield
ensure
  `Opal.current_dir = #{prev_cwd}`
end

.homeObject


16
17
18
# File 'opal/opal/corelib/dir.rb', line 16

def home
  ENV['HOME'] || '.'
end

.pwdObject Also known as: getwd


11
12
13
# File 'opal/opal/corelib/dir.rb', line 11

def pwd
  `Opal.current_dir || '.'`
end