Sha256: 6def0e672c53ed400713be7f4ef77faf0d566297da630fb3574363d766596378

Contents?: true

Size: 889 Bytes

Versions: 89

Compression:

Stored size: 889 Bytes

Contents

require 'safe_yaml/load'
require 'yaml/store'

module SafeYAML

  class Store < YAML::Store

    # Override YAML::Store#initialize to accept additional option
    # +safe_yaml_opts+.
    def initialize(file_name, yaml_opts = {}, safe_yaml_opts = {})
      @safe_yaml_opts = safe_yaml_opts
      super(file_name, yaml_opts)
    end

    # 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.
    #++
    def load(content)
      table = safe_yaml_load(content)
      table == false ? {} : table
    end

    private

    if SafeYAML::YAML_ENGINE == 'psych'
      def safe_yaml_load(content)
        SafeYAML.load(content, nil, @safe_yaml_opts)
      end
    else
      def safe_yaml_load(content)
        SafeYAML.load(content, @safe_yaml_opts)
      end
    end

  end

end

Version data entries

89 entries across 74 versions & 7 rubygems

Version Path
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/safe_yaml-1.0.5/lib/safe_yaml/store.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/brakeman-4.7.0/bundle/ruby/2.6.0/gems/safe_yaml-1.0.5/lib/safe_yaml/store.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/brakeman-4.7.1/bundle/ruby/2.6.0/gems/safe_yaml-1.0.5/lib/safe_yaml/store.rb
brakeman-4.7.1 bundle/ruby/2.6.0/gems/safe_yaml-1.0.5/lib/safe_yaml/store.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/brakeman-4.7.0/bundle/ruby/2.6.0/gems/safe_yaml-1.0.5/lib/safe_yaml/store.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/safe_yaml-1.0.5/lib/safe_yaml/store.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/brakeman-4.5.1/bundle/ruby/2.5.0/gems/safe_yaml-1.0.5/lib/safe_yaml/store.rb
vagrant-unbundled-2.2.6.1 vendor/bundle/ruby/2.6.0/gems/safe_yaml-1.0.5/lib/safe_yaml/store.rb
vagrant-unbundled-2.2.6.0 vendor/bundle/ruby/2.6.0/gems/safe_yaml-1.0.5/lib/safe_yaml/store.rb
brakeman-4.7.0 bundle/ruby/2.6.0/gems/safe_yaml-1.0.5/lib/safe_yaml/store.rb
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/brakeman-4.5.1/bundle/ruby/2.5.0/gems/safe_yaml-1.0.5/lib/safe_yaml/store.rb
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/safe_yaml-1.0.5/lib/safe_yaml/store.rb
cloudsmith-api-0.44.4 vendor/bundle/ruby/2.3.0/gems/safe_yaml-1.0.5/lib/safe_yaml/store.rb
zuora_connect_ui-0.8.3 vendor/ruby/2.6.0/gems/brakeman-4.5.1/bundle/ruby/2.5.0/gems/safe_yaml-1.0.5/lib/safe_yaml/store.rb
zuora_connect_ui-0.8.3 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/safe_yaml-1.0.5/lib/safe_yaml/store.rb
zuora_connect_ui-0.8.2 vendor/ruby/2.6.0/gems/brakeman-4.5.1/bundle/ruby/2.5.0/gems/safe_yaml-1.0.5/lib/safe_yaml/store.rb
zuora_connect_ui-0.8.2 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/safe_yaml-1.0.5/lib/safe_yaml/store.rb
zuora_connect_ui-0.8.1 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/safe_yaml-1.0.5/lib/safe_yaml/store.rb
zuora_connect_ui-0.8.1 vendor/ruby/2.6.0/gems/brakeman-4.5.1/bundle/ruby/2.5.0/gems/safe_yaml-1.0.5/lib/safe_yaml/store.rb
zuora_connect_ui-0.8.0 vendor/ruby/2.6.0/gems/brakeman-4.6.1/bundle/ruby/2.6.0/gems/safe_yaml-1.0.5/lib/safe_yaml/store.rb