Module: YAML

Defined in:
lib/bashly/extensions/yaml.rb

Class Method Summary collapse

Class Method Details

.load_erb_file(path) ⇒ Object



18
19
20
# File 'lib/bashly/extensions/yaml.rb', line 18

def load_erb_file(path)
  YAML.trusted_load ERB.new(File.read(path)).result
end

.trusted_load(content) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/bashly/extensions/yaml.rb', line 6

def trusted_load(content)
  if YAML.respond_to? :unsafe_load
    YAML.unsafe_load content
  else
    YAML.load content
  end
end

.trusted_load_file(path) ⇒ Object



14
15
16
# File 'lib/bashly/extensions/yaml.rb', line 14

def trusted_load_file(path)
  trusted_load File.read(path)
end