Class: Dir

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

Overview

backtick_javascript: true

Class Method Summary collapse

Class Method Details

.chdir(dir) ⇒ Object



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

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

.homeObject



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

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

.pwdObject Also known as: getwd



13
14
15
# File 'opal/opal/corelib/dir.rb', line 13

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