Class: MuxTf::UnsafeYamlStore

Inherits:
YAML::Store
  • Object
show all
Defined in:
lib/mux_tf/yaml_cache.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ UnsafeYamlStore

Returns a new instance of UnsafeYamlStore.



43
44
45
46
# File 'lib/mux_tf/yaml_cache.rb', line 43

def initialize(*args)
  super
  @opt[:permitted_classes] ||= [Symbol]
end

Instance Method Details

#load(content) ⇒ Object

basically have to override the whole load method, since it doesn’t allow customization of the allowed classes ..



49
50
51
52
53
54
55
56
# File 'lib/mux_tf/yaml_cache.rb', line 49

def load(content)
  table = YAML.safe_load(content, **@opt)
  if [false, nil].include?(table)
    {}
  else
    table
  end
end