Module: Elixir::System

Defined in:
lib/elixir/system.rb

Class Method Summary collapse

Class Method Details

.argvObject



8
9
10
# File 'lib/elixir/system.rb', line 8

def argv
  ARGV
end

.argv=(new_argv) ⇒ Object



12
13
14
# File 'lib/elixir/system.rb', line 12

def argv= new_argv
  Object.const_set :ARGV, new_argv
end

.at_exit(fun) ⇒ Object



16
17
18
# File 'lib/elixir/system.rb', line 16

def at_exit fun
  at_exit &fun
end

.build_infoObject



20
21
22
23
24
25
# File 'lib/elixir/system.rb', line 20

def build_info
  version = RUBY_VERSION
  date = Date.parse(RUBY_RELEASE_DATE).rfc2822

  {version: version, date: date}.inspect
end

.cmd(command, args, opts = []) ⇒ Object



27
28
29
# File 'lib/elixir/system.rb', line 27

def cmd command, args, opts = []
  # TODO
end

.cwdObject



31
32
33
# File 'lib/elixir/system.rb', line 31

def cwd
  Dir.pwd rescue nil
end

.cwd!Object



35
36
37
# File 'lib/elixir/system.rb', line 35

def cwd!
  Dir.pwd
end

.delete_env(varname) ⇒ Object



39
40
41
# File 'lib/elixir/system.rb', line 39

def delete_env varname
  ENV.delete varname
end

.find_executable(program) ⇒ Object



43
44
45
# File 'lib/elixir/system.rb', line 43

def find_executable program
  # TODO
end

.get_env(varname) ⇒ Object



47
48
49
# File 'lib/elixir/system.rb', line 47

def get_env varname
  ENV[varname]
end

.get_pidObject



51
52
53
# File 'lib/elixir/system.rb', line 51

def get_pid
  Process.pid.to_s
end

.halt(status = 0) ⇒ Object



55
56
57
# File 'lib/elixir/system.rb', line 55

def halt status = 0
  exit status
end

.put_env(varname, value) ⇒ Object



59
60
61
# File 'lib/elixir/system.rb', line 59

def put_env varname, value
  ENV[varname] = value
end

.put_envs(hash) ⇒ Object



63
64
65
# File 'lib/elixir/system.rb', line 63

def put_envs hash
  hash.each { |varname, value| ENV[varname] = value }
end

.stacktraceObject



67
68
69
# File 'lib/elixir/system.rb', line 67

def stacktrace
  caller_locations
end

.tmp_dirObject



71
72
73
# File 'lib/elixir/system.rb', line 71

def tmp_dir
  Dir.tmpdir rescue nil
end

.tmp_dir!Object



75
76
77
# File 'lib/elixir/system.rb', line 75

def tmp_dir!
  Dir.tmpdir
end

.user_homeObject



79
80
81
# File 'lib/elixir/system.rb', line 79

def user_home
  Dir.home(Etc.getlogin) rescue nil
end

.user_home!Object



83
84
85
# File 'lib/elixir/system.rb', line 83

def user_home!
  Dir.home Etc.getlogin
end

.versionObject



87
88
89
# File 'lib/elixir/system.rb', line 87

def version
  RUBY_VERSION
end