Sha256: 47b87ef0a9385ef12bcf92d1c88eb123fe25bfe096cf5c0a208f3955f77cdfa5

Contents?: true

Size: 723 Bytes

Versions: 4

Compression:

Stored size: 723 Bytes

Contents

# lib/lutaml/model/toml_adapter.rb

module Lutaml
  module Model
    module TomlAdapter
      class TomlObject
        attr_reader :attributes

        def initialize(attributes = {})
          @attributes = attributes
        end

        def [](key)
          @attributes[key]
        end

        def []=(key, value)
          @attributes[key] = value
        end

        def to_h
          @attributes
        end
      end

      class Document < TomlObject
        def self.parse(toml)
          raise NotImplementedError, "Subclasses must implement `parse`."
        end

        def to_toml(*args)
          raise NotImplementedError, "Subclasses must implement `to_toml`."
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lutaml-model-0.3.1 lib/lutaml/model/toml_adapter.rb
lutaml-model-0.3.0 lib/lutaml/model/toml_adapter.rb
lutaml-model-0.2.1 lib/lutaml/model/toml_adapter.rb
lutaml-model-0.1.0 lib/lutaml/model/toml_adapter.rb