Sha256: 5b9aceae2cf6bb000b73102ec2a2da2ab87cba098c2a3ddae135ad3245046faa

Contents?: true

Size: 995 Bytes

Versions: 4

Compression:

Stored size: 995 Bytes

Contents

require "lutaml/model"

class Vase < Lutaml::Model::Serializable
  attribute :height, Lutaml::Model::Type::Float
  attribute :diameter, Lutaml::Model::Type::Float
  attribute :material, Lutaml::Model::Type::String
  attribute :manufacturer, Lutaml::Model::Type::String

  json do
    map "height", to: :height
    map "diameter", to: :diameter
    map "material", to: :material
    map "manufacturer", to: :manufacturer
  end

  yaml do
    map "height", to: :height
    map "diameter", to: :diameter
    map "material", to: :material
    map "manufacturer", to: :manufacturer
  end

  toml do
    map "height", to: :height
    map "diameter", to: :diameter
    map "material", to: :material
    map "manufacturer", to: :manufacturer
  end

  xml do
    root "vase"
    namespace "https://example.com/vase/1.0"
    map_element "height", to: :height
    map_element "diameter", to: :diameter
    map_element "material", to: :material
    map_attribute "manufacturer", to: :manufacturer
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lutaml-model-0.3.28 spec/fixtures/vase.rb
lutaml-model-0.3.27 spec/fixtures/vase.rb
lutaml-model-0.3.26 spec/fixtures/vase.rb
lutaml-model-0.3.25 spec/fixtures/vase.rb