Class: SafeYAML::Store

Inherits:
YAML::Store
  • Object
show all
Defined in:
lib/safe_yaml/store.rb

Instance Method Summary collapse

Constructor Details

#initialize(file_name, yaml_opts = {}, safe_yaml_opts = {}) ⇒ Store

Override YAML::Store#initialize to accept additional option safe_yaml_opts.



10
11
12
13
# File 'lib/safe_yaml/store.rb', line 10

def initialize(file_name, yaml_opts = {}, safe_yaml_opts = {})
  @safe_yaml_opts = safe_yaml_opts
  super(file_name, yaml_opts)
end

Instance Method Details

#load(content) ⇒ Object

Override YAML::Store#load to use SafeYAML.load instead of YAML.load (via #safe_yaml_load). – PStore#load is private, while YAML::Store#load is public. ++



20
21
22
23
# File 'lib/safe_yaml/store.rb', line 20

def load(content)
  table = safe_yaml_load(content)
  table == false ? {} : table
end