Sha256: 622729f015c281aa591446b8cfc05b560eb1d18a49a6be52da85c179b9e3b123
Contents?: true
Size: 1004 Bytes
Versions: 8
Compression:
Stored size: 1004 Bytes
Contents
# coding: utf-8 require "dry/types" # TODO: Find a way to avoid registering this globally Dry::Logic::Predicates.predicate :respond_to? do |method_name, value| value.respond_to?(method_name) end module Formalist module Types include Dry::Types.module ElementName = Types::Strict::Symbol.constrained(min_size: 1).optional OptionsList = Types::Array.of(Formalist::Types::Array.of(Formalist::Types::Strict::String).constrained(size: 2)) # The SelectionField and MultiSelectionField require a _somewhat_ specific # data structure: # # {id: 123, label: 'foo'} # # It’s expected that `id` is the relational representation of the object. # And label could/should be optional if the form defines a custom # `render_as` attribute SelectionsList = Formalist::Types::Strict::Array.of(Formalist::Types::Strict::Hash) Validation = Types::Strict::Hash Dependency = Types::Object Function = Dependency.constrained(respond_to: :call) end end
Version data entries
8 entries across 8 versions & 1 rubygems