Sha256: ef944ff69f368087d40f14011729c58ddfd438ed3fff0816b56580aef34e1fd9

Contents?: true

Size: 740 Bytes

Versions: 19

Compression:

Stored size: 740 Bytes

Contents

require "yaml"
require_relative "yaml_document"

module Lutaml
  module Model
    module YamlAdapter
      class StandardYamlAdapter < YamlDocument
        PERMITTED_CLASSES_BASE = [Date, Time, DateTime, Symbol, Hash,
                                  Array].freeze

        PERMITTED_CLASSES = if defined?(BigDecimal)
                              PERMITTED_CLASSES_BASE + [BigDecimal]
                            else
                              PERMITTED_CLASSES_BASE
                            end.freeze

        def self.parse(yaml)
          YAML.safe_load(yaml, permitted_classes: PERMITTED_CLASSES)
        end

        def to_yaml(options = {})
          YAML.dump(@attributes, options)
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
lutaml-model-0.3.29 lib/lutaml/model/yaml_adapter/standard_yaml_adapter.rb
lutaml-model-0.3.28 lib/lutaml/model/yaml_adapter/standard_yaml_adapter.rb
lutaml-model-0.3.27 lib/lutaml/model/yaml_adapter/standard_yaml_adapter.rb
lutaml-model-0.3.26 lib/lutaml/model/yaml_adapter/standard_yaml_adapter.rb
lutaml-model-0.3.25 lib/lutaml/model/yaml_adapter/standard_yaml_adapter.rb
lutaml-model-0.3.24 lib/lutaml/model/yaml_adapter/standard_yaml_adapter.rb
lutaml-model-0.3.23 lib/lutaml/model/yaml_adapter/standard_yaml_adapter.rb
lutaml-model-0.3.22 lib/lutaml/model/yaml_adapter/standard_yaml_adapter.rb
lutaml-model-0.3.21 lib/lutaml/model/yaml_adapter/standard_yaml_adapter.rb
lutaml-model-0.3.20 lib/lutaml/model/yaml_adapter/standard_yaml_adapter.rb
lutaml-model-0.3.19 lib/lutaml/model/yaml_adapter/standard_yaml_adapter.rb
lutaml-model-0.3.18 lib/lutaml/model/yaml_adapter/standard_yaml_adapter.rb
lutaml-model-0.3.17 lib/lutaml/model/yaml_adapter/standard_yaml_adapter.rb
lutaml-model-0.3.16 lib/lutaml/model/yaml_adapter/standard_yaml_adapter.rb
lutaml-model-0.3.15 lib/lutaml/model/yaml_adapter/standard_yaml_adapter.rb
lutaml-model-0.3.14 lib/lutaml/model/yaml_adapter/standard_yaml_adapter.rb
lutaml-model-0.3.13 lib/lutaml/model/yaml_adapter/standard_yaml_adapter.rb
lutaml-model-0.3.12 lib/lutaml/model/yaml_adapter/standard_yaml_adapter.rb
lutaml-model-0.3.11 lib/lutaml/model/yaml_adapter/standard_yaml_adapter.rb