Module: YAML

Defined in:
opal/stdlib/nodejs/yaml.rb

Class Method Summary collapse

Class Method Details

.load(data) ⇒ Object



14
15
16
17
18
# File 'opal/stdlib/nodejs/yaml.rb', line 14

def self.load(data)
  loaded = `__yaml__.safeLoad(data)`
  loaded = Hash.new(loaded) if native?(loaded)
  loaded
end

.load_path(path) ⇒ Object



10
11
12
# File 'opal/stdlib/nodejs/yaml.rb', line 10

def self.load_path(path)
  load(`#{File}.__fs__.readFileSync(#{path}, 'utf8')`)
end