Sha256: c1245eb66955debd8f859162925424d5fd8da559701b978a2d4c823186c57dea

Contents?: true

Size: 1.13 KB

Versions: 4

Compression:

Stored size: 1.13 KB

Contents

# typed: strict

module DataModel
	module Fixtures::Array
		extend self
		extend T::Sig
		include Fixtures

		sig { returns(Example) }
		def string_array
			Example.new(
				[:array, :string],
				variants: {
					strings: ["a", "b", "c"],
					string: ["a", ["a"]],
					number: [1, ["1"]],
					missing: nil,
					numbers: [[1, 2, 3], ["1", "2", "3"]],
					other_type: Object.new
				},
			)
		end

		sig { returns(Example) }
		def wrapping_string_array
			Example.new(
				[:array, { wrap_single_value: true }, :string],
				variants: {
					strings: ["a", "b", "c"],
					string: ["a", ["a"]],
					number: [1, ["1"]],
					missing: nil,
					numbers: [[1, 2, 3], ["1", "2", "3"]],
					other_type: Object.new
				},
			)
		end

		sig { returns(Example) }
		def optional_string_array
			Example.new(
				[:array, { optional: true }, :string],
				variants: {
					strings: ["a", "b", "c"],
					missing: nil
				},
			)
		end

		sig { returns(Example) }
		def array_optional_string
			Example.new(
				[:array, [:string, { optional: true }]],
				variants: {
					optional_strings: ["a", nil, "c"],
					numbers: [1, nil, 3]
				},
			)
		end
	end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
data_model-0.4.0 lib/data_model/fixtures/array.rb
data_model-0.3.0 lib/data_model/fixtures/array.rb
data_model-0.2.0 lib/data_model/fixtures/array.rb
data_model-0.1.0 lib/data_model/fixtures/array.rb