Class: ENV
Overview
:nodoc:
Class Method Summary collapse
- .[](name) ⇒ Object
- .[]=(name, value) ⇒ Object
- .delete(name) ⇒ Object
- .empty? ⇒ Boolean
- .key?(name) ⇒ Boolean (also: has_key?, include?, member?)
- .keys ⇒ Object
-
.pretty_print(q) ⇒ Object
:nodoc:.
- .to_s ⇒ Object
Class Method Details
.[](name) ⇒ Object
4 5 6 |
# File 'opal/stdlib/nodejs/env.rb', line 4 def [](name) `process.env[#{name}] || nil` end |
.[]=(name, value) ⇒ Object
8 9 10 |
# File 'opal/stdlib/nodejs/env.rb', line 8 def []=(name, value) `process.env[#{name.to_s}] = #{value.to_s}` end |
.delete(name) ⇒ Object
29 30 31 32 33 34 35 |
# File 'opal/stdlib/nodejs/env.rb', line 29 def delete(name) %x{ var value = process.env[#{name}] || nil; delete process.env[#{name}]; return value; } end |
.empty? ⇒ Boolean
21 22 23 |
# File 'opal/stdlib/nodejs/env.rb', line 21 def empty? `Object.keys(process.env).length === 0` end |
.key?(name) ⇒ Boolean Also known as: has_key?, include?, member?
12 13 14 |
# File 'opal/stdlib/nodejs/env.rb', line 12 def key?(name) `process.env.hasOwnProperty(#{name})` end |
.keys ⇒ Object
25 26 27 |
# File 'opal/stdlib/nodejs/env.rb', line 25 def keys `Object.keys(process.env)` end |
.pretty_print(q) ⇒ Object
:nodoc:
359 360 361 362 363 364 365 |
# File 'opal/stdlib/pp.rb', line 359 def pretty_print(q) # :nodoc: h = {} ENV.keys.sort.each {|k| h[k] = ENV[k] } q.pp_hash h end |
.to_s ⇒ Object
37 38 39 |
# File 'opal/stdlib/nodejs/env.rb', line 37 def to_s 'ENV' end |