Sha256: 1abdb400563bb05eb4281db5c0844cebf5abe9c68a3ca3cd27bfe5de148f4fe7

Contents?: true

Size: 540 Bytes

Versions: 14

Compression:

Stored size: 540 Bytes

Contents

# frozen_string_literal: true

module Bridgetown
  class YAMLParser
    PERMITTED_CLASSES = [Date, Time, Rb].freeze

    class << self
      def load_file(filename, **kwargs)
        kwargs = { permitted_classes: PERMITTED_CLASSES }.merge(kwargs)
        YAML.safe_load_file(filename, **kwargs)
      end

      def load(yaml)
        if RUBY_VERSION.start_with?("2.5")
          YAML.safe_load yaml, PERMITTED_CLASSES
        else
          YAML.safe_load yaml, permitted_classes: PERMITTED_CLASSES
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
bridgetown-core-1.0.0.alpha6 lib/bridgetown-core/yaml_parser.rb
bridgetown-core-1.0.0.alpha5 lib/bridgetown-core/yaml_parser.rb
bridgetown-core-0.21.5 lib/bridgetown-core/yaml_parser.rb
bridgetown-core-1.0.0.alpha4 lib/bridgetown-core/yaml_parser.rb
bridgetown-core-1.0.0.alpha3 lib/bridgetown-core/yaml_parser.rb
bridgetown-core-1.0.0.alpha2 lib/bridgetown-core/yaml_parser.rb
bridgetown-core-1.0.0.alpha1 lib/bridgetown-core/yaml_parser.rb
bridgetown-core-0.21.4 lib/bridgetown-core/yaml_parser.rb
bridgetown-core-0.21.3 lib/bridgetown-core/yaml_parser.rb
bridgetown-core-0.21.2 lib/bridgetown-core/yaml_parser.rb
bridgetown-core-0.21.1 lib/bridgetown-core/yaml_parser.rb
bridgetown-core-0.21.0 lib/bridgetown-core/yaml_parser.rb
bridgetown-core-0.21.0.beta4 lib/bridgetown-core/yaml_parser.rb
bridgetown-core-0.21.0.beta3 lib/bridgetown-core/yaml_parser.rb