Sha256: c977ccb13f95d9ab2b4fe614c26d1830cf9f44a7ed546e54d65ea956301f4fcf

Contents?: true

Size: 781 Bytes

Versions: 11

Compression:

Stored size: 781 Bytes

Contents

module Lutaml
  module Model
    module Type
      class String < Value
        def self.cast(value)
          return nil if value.nil?

          value.to_s
        end

        # xs:string format
        def to_xml
          value&.to_s
        end

        # JSON string
        def to_json(*_args)
          value
        end

        # YAML string
        def to_yaml
          value
        end

        # TOML string
        def to_toml
          value&.to_s
        end

        def self.from_xml(value)
          cast(value)
        end

        def self.from_json(value)
          cast(value)
        end

        def self.from_yaml(value)
          cast(value)
        end

        def self.from_toml(value)
          cast(value)
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
lutaml-model-0.5.3 lib/lutaml/model/type/string.rb
lutaml-model-0.5.2 lib/lutaml/model/type/string.rb
lutaml-model-0.5.1 lib/lutaml/model/type/string.rb
lutaml-model-0.5.0 lib/lutaml/model/type/string.rb
lutaml-model-0.4.0 lib/lutaml/model/type/string.rb
lutaml-model-0.3.30 lib/lutaml/model/type/string.rb
lutaml-model-0.3.29 lib/lutaml/model/type/string.rb
lutaml-model-0.3.28 lib/lutaml/model/type/string.rb
lutaml-model-0.3.27 lib/lutaml/model/type/string.rb
lutaml-model-0.3.26 lib/lutaml/model/type/string.rb
lutaml-model-0.3.25 lib/lutaml/model/type/string.rb