roast-ai 0.4.4 → 0.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/CODEOWNERS +2 -0
- data/.github/workflows/ci.yaml +1 -0
- data/.gitignore +0 -26
- data/.rubocop.yml +13 -0
- data/.rubocop_todo.yml +21 -0
- data/CHANGELOG.md +37 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +43 -1
- data/bin/rubocop +27 -0
- data/bin/spoom +27 -0
- data/bin/srb +27 -0
- data/bin/srb-rbi +27 -0
- data/bin/tapioca +27 -0
- data/docs/INSTRUMENTATION.md +3 -3
- data/dsl/simple.rb +10 -0
- data/examples/retry/workflow.yml +23 -0
- data/lib/roast/dsl/executor.rb +26 -0
- data/lib/roast/dsl.rb +7 -0
- data/lib/roast/errors.rb +1 -0
- data/lib/roast/factories/api_provider_factory.rb +1 -0
- data/lib/roast/helpers/function_caching_interceptor.rb +3 -0
- data/lib/roast/helpers/logger.rb +6 -9
- data/lib/roast/helpers/metadata_access.rb +1 -0
- data/lib/roast/helpers/minitest_coverage_runner.rb +1 -0
- data/lib/roast/helpers/path_resolver.rb +8 -18
- data/lib/roast/helpers/prompt_loader.rb +3 -2
- data/lib/roast/helpers/timeout_handler.rb +3 -5
- data/lib/roast/initializers.rb +1 -0
- data/lib/roast/resources/api_resource.rb +4 -3
- data/lib/roast/resources/base_resource.rb +1 -0
- data/lib/roast/resources/directory_resource.rb +1 -0
- data/lib/roast/resources/file_resource.rb +1 -0
- data/lib/roast/resources/none_resource.rb +1 -0
- data/lib/roast/resources/url_resource.rb +2 -1
- data/lib/roast/resources.rb +1 -2
- data/lib/roast/services/context_threshold_checker.rb +1 -0
- data/lib/roast/services/token_counting_service.rb +1 -0
- data/lib/roast/tools/apply_diff.rb +1 -0
- data/lib/roast/tools/ask_user.rb +1 -0
- data/lib/roast/tools/bash.rb +1 -0
- data/lib/roast/tools/cmd.rb +1 -0
- data/lib/roast/tools/coding_agent.rb +1 -0
- data/lib/roast/tools/context_summarizer.rb +1 -0
- data/lib/roast/tools/grep.rb +1 -0
- data/lib/roast/tools/helpers/coding_agent_message_formatter.rb +1 -0
- data/lib/roast/tools/read_file.rb +1 -0
- data/lib/roast/tools/search_file.rb +1 -0
- data/lib/roast/tools/swarm.rb +1 -0
- data/lib/roast/tools/update_files.rb +1 -0
- data/lib/roast/tools/write_file.rb +1 -0
- data/lib/roast/tools.rb +2 -0
- data/lib/roast/value_objects/api_token.rb +1 -0
- data/lib/roast/value_objects/step_name.rb +1 -0
- data/lib/roast/value_objects/uri_base.rb +1 -0
- data/lib/roast/value_objects/workflow_path.rb +1 -0
- data/lib/roast/value_objects.rb +1 -0
- data/lib/roast/version.rb +2 -1
- data/lib/roast/workflow/agent_step.rb +1 -0
- data/lib/roast/workflow/api_configuration.rb +1 -0
- data/lib/roast/workflow/base_iteration_step.rb +1 -0
- data/lib/roast/workflow/base_step.rb +1 -0
- data/lib/roast/workflow/base_workflow.rb +1 -0
- data/lib/roast/workflow/case_executor.rb +1 -0
- data/lib/roast/workflow/case_step.rb +1 -0
- data/lib/roast/workflow/command_executor.rb +1 -0
- data/lib/roast/workflow/conditional_executor.rb +1 -0
- data/lib/roast/workflow/conditional_step.rb +1 -0
- data/lib/roast/workflow/configuration.rb +9 -0
- data/lib/roast/workflow/configuration_loader.rb +4 -1
- data/lib/roast/workflow/context_manager.rb +1 -0
- data/lib/roast/workflow/context_path_resolver.rb +1 -0
- data/lib/roast/workflow/dot_access_hash.rb +1 -0
- data/lib/roast/workflow/each_step.rb +1 -0
- data/lib/roast/workflow/error_handler.rb +39 -3
- data/lib/roast/workflow/expression_evaluator.rb +1 -0
- data/lib/roast/workflow/expression_utils.rb +1 -0
- data/lib/roast/workflow/file_state_repository.rb +2 -1
- data/lib/roast/workflow/input_executor.rb +1 -0
- data/lib/roast/workflow/input_step.rb +1 -0
- data/lib/roast/workflow/interpolator.rb +2 -1
- data/lib/roast/workflow/iteration_executor.rb +1 -0
- data/lib/roast/workflow/llm_boolean_coercer.rb +1 -0
- data/lib/roast/workflow/metadata_manager.rb +1 -0
- data/lib/roast/workflow/output_handler.rb +1 -0
- data/lib/roast/workflow/output_manager.rb +1 -0
- data/lib/roast/workflow/parallel_executor.rb +1 -0
- data/lib/roast/workflow/prompt_step.rb +1 -0
- data/lib/roast/workflow/repeat_step.rb +1 -0
- data/lib/roast/workflow/replay_handler.rb +1 -0
- data/lib/roast/workflow/resource_resolver.rb +2 -6
- data/lib/roast/workflow/session_manager.rb +1 -0
- data/lib/roast/workflow/shell_script_step.rb +1 -0
- data/lib/roast/workflow/sqlite_state_repository.rb +1 -0
- data/lib/roast/workflow/state_manager.rb +1 -0
- data/lib/roast/workflow/state_repository.rb +1 -0
- data/lib/roast/workflow/state_repository_factory.rb +4 -2
- data/lib/roast/workflow/step_completion_reporter.rb +1 -0
- data/lib/roast/workflow/step_executor_coordinator.rb +17 -6
- data/lib/roast/workflow/step_executor_factory.rb +1 -0
- data/lib/roast/workflow/step_executor_registry.rb +2 -3
- data/lib/roast/workflow/step_executor_with_reporting.rb +1 -0
- data/lib/roast/workflow/step_executors/base_step_executor.rb +1 -0
- data/lib/roast/workflow/step_executors/hash_step_executor.rb +1 -0
- data/lib/roast/workflow/step_executors/parallel_step_executor.rb +1 -0
- data/lib/roast/workflow/step_executors/string_step_executor.rb +1 -0
- data/lib/roast/workflow/step_factory.rb +1 -0
- data/lib/roast/workflow/step_finder.rb +1 -0
- data/lib/roast/workflow/step_loader.rb +1 -0
- data/lib/roast/workflow/step_name_extractor.rb +1 -0
- data/lib/roast/workflow/step_runner.rb +1 -0
- data/lib/roast/workflow/step_type_resolver.rb +1 -0
- data/lib/roast/workflow/validation_command.rb +1 -0
- data/lib/roast/workflow/validator.rb +1 -0
- data/lib/roast/workflow/validators/base_validator.rb +1 -0
- data/lib/roast/workflow/validators/dependency_validator.rb +1 -0
- data/lib/roast/workflow/validators/linting_validator.rb +1 -0
- data/lib/roast/workflow/validators/schema_validator.rb +1 -0
- data/lib/roast/workflow/validators/step_collector.rb +1 -0
- data/lib/roast/workflow/validators/validation_orchestrator.rb +1 -0
- data/lib/roast/workflow/workflow_context.rb +1 -0
- data/lib/roast/workflow/workflow_execution_context.rb +1 -0
- data/lib/roast/workflow/workflow_executor.rb +2 -1
- data/lib/roast/workflow/workflow_initializer.rb +16 -1
- data/lib/roast/workflow/workflow_runner.rb +66 -55
- data/lib/roast/workflow.rb +1 -0
- data/lib/roast/workflow_diagram_generator.rb +3 -2
- data/lib/roast.rb +23 -8
- data/sorbet/config +8 -0
- data/sorbet/rbi/dsl/.gitattributes +1 -0
- data/sorbet/rbi/dsl/active_support/callbacks.rbi +21 -0
- data/sorbet/rbi/gems/.gitattributes +1 -0
- data/sorbet/rbi/gems/activesupport@8.0.2.rbi +19107 -0
- data/sorbet/rbi/gems/addressable@2.8.7.rbi +1994 -0
- data/sorbet/rbi/gems/ast@2.4.3.rbi +585 -0
- data/sorbet/rbi/gems/base64@0.3.0.rbi +545 -0
- data/sorbet/rbi/gems/benchmark@0.4.1.rbi +619 -0
- data/sorbet/rbi/gems/bigdecimal@3.2.2.rbi +62 -0
- data/sorbet/rbi/gems/cgi@0.5.0.rbi +2961 -0
- data/sorbet/rbi/gems/claude_swarm@0.1.19.rbi +568 -0
- data/sorbet/rbi/gems/cli-kit@5.0.1.rbi +1991 -0
- data/sorbet/rbi/gems/cli-ui@2.3.0.rbi +3181 -0
- data/sorbet/rbi/gems/coderay@1.1.3.rbi +9 -0
- data/sorbet/rbi/gems/concurrent-ruby@1.3.5.rbi +11657 -0
- data/sorbet/rbi/gems/connection_pool@2.5.3.rbi +9 -0
- data/sorbet/rbi/gems/crack@1.0.0.rbi +145 -0
- data/sorbet/rbi/gems/diff-lcs@1.6.2.rbi +972 -0
- data/sorbet/rbi/gems/dotenv@3.1.8.rbi +295 -0
- data/sorbet/rbi/gems/drb@2.2.3.rbi +1661 -0
- data/sorbet/rbi/gems/dry-configurable@1.3.0.rbi +672 -0
- data/sorbet/rbi/gems/dry-core@1.1.0.rbi +1894 -0
- data/sorbet/rbi/gems/dry-inflector@1.2.0.rbi +659 -0
- data/sorbet/rbi/gems/dry-initializer@3.2.0.rbi +781 -0
- data/sorbet/rbi/gems/dry-logic@1.6.0.rbi +1127 -0
- data/sorbet/rbi/gems/dry-schema@1.14.1.rbi +3727 -0
- data/sorbet/rbi/gems/dry-types@1.8.3.rbi +3969 -0
- data/sorbet/rbi/gems/erubi@1.13.1.rbi +155 -0
- data/sorbet/rbi/gems/event_stream_parser@1.0.0.rbi +49 -0
- data/sorbet/rbi/gems/faraday-multipart@1.1.1.rbi +283 -0
- data/sorbet/rbi/gems/faraday-net_http@3.4.1.rbi +147 -0
- data/sorbet/rbi/gems/faraday-retry@2.3.2.rbi +9 -0
- data/sorbet/rbi/gems/faraday@2.13.1.rbi +2977 -0
- data/sorbet/rbi/gems/fast-mcp-annotations@1.5.3.rbi +1588 -0
- data/sorbet/rbi/gems/ffi@1.17.2.rbi +9 -0
- data/sorbet/rbi/gems/formatador@1.1.0.rbi +9 -0
- data/sorbet/rbi/gems/guard-compat@1.2.1.rbi +102 -0
- data/sorbet/rbi/gems/guard-minitest@2.4.6.rbi +402 -0
- data/sorbet/rbi/gems/guard@2.19.1.rbi +2283 -0
- data/sorbet/rbi/gems/hashdiff@1.2.0.rbi +355 -0
- data/sorbet/rbi/gems/i18n@1.14.7.rbi +2359 -0
- data/sorbet/rbi/gems/json-schema@5.1.1.rbi +1466 -0
- data/sorbet/rbi/gems/json@2.12.2.rbi +2051 -0
- data/sorbet/rbi/gems/language_server-protocol@3.17.0.5.rbi +9 -0
- data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +9 -0
- data/sorbet/rbi/gems/listen@3.9.0.rbi +1206 -0
- data/sorbet/rbi/gems/logger@1.7.0.rbi +963 -0
- data/sorbet/rbi/gems/lumberjack@1.2.10.rbi +1830 -0
- data/sorbet/rbi/gems/method_source@1.1.0.rbi +9 -0
- data/sorbet/rbi/gems/mime-types-data@3.2025.0617.rbi +136 -0
- data/sorbet/rbi/gems/mime-types@3.7.0.rbi +1342 -0
- data/sorbet/rbi/gems/minitest-rg@5.3.0.rbi +160 -0
- data/sorbet/rbi/gems/minitest@5.25.5.rbi +1640 -0
- data/sorbet/rbi/gems/mocha@2.7.1.rbi +12 -0
- data/sorbet/rbi/gems/multipart-post@2.4.1.rbi +244 -0
- data/sorbet/rbi/gems/nenv@0.3.0.rbi +147 -0
- data/sorbet/rbi/gems/net-http@0.6.0.rbi +4247 -0
- data/sorbet/rbi/gems/netrc@0.11.0.rbi +159 -0
- data/sorbet/rbi/gems/notiffany@0.1.3.rbi +1079 -0
- data/sorbet/rbi/gems/open_router@0.3.3.rbi +230 -0
- data/sorbet/rbi/gems/ostruct@0.6.2.rbi +354 -0
- data/sorbet/rbi/gems/parallel@1.27.0.rbi +291 -0
- data/sorbet/rbi/gems/parser@3.3.8.0.rbi +5535 -0
- data/sorbet/rbi/gems/prism@1.4.0.rbi +41732 -0
- data/sorbet/rbi/gems/pry@0.15.2.rbi +9 -0
- data/sorbet/rbi/gems/public_suffix@6.0.2.rbi +936 -0
- data/sorbet/rbi/gems/racc@1.8.1.rbi +158 -0
- data/sorbet/rbi/gems/rack@2.2.17.rbi +5659 -0
- data/sorbet/rbi/gems/rainbow@3.1.1.rbi +9 -0
- data/sorbet/rbi/gems/raix@1.0.2.rbi +1104 -0
- data/sorbet/rbi/gems/rake@13.3.0.rbi +3036 -0
- data/sorbet/rbi/gems/rb-fsevent@0.11.2.rbi +9 -0
- data/sorbet/rbi/gems/rb-inotify@0.11.1.rbi +9 -0
- data/sorbet/rbi/gems/rbi@0.3.6.rbi +6893 -0
- data/sorbet/rbi/gems/rbs@3.9.4.rbi +6978 -0
- data/sorbet/rbi/gems/regexp_parser@2.10.0.rbi +9 -0
- data/sorbet/rbi/gems/rexml@3.4.1.rbi +5346 -0
- data/sorbet/rbi/gems/rubocop-ast@1.45.1.rbi +9 -0
- data/sorbet/rbi/gems/rubocop-shopify@2.17.1.rbi +9 -0
- data/sorbet/rbi/gems/rubocop@1.77.0.rbi +9 -0
- data/sorbet/rbi/gems/ruby-graphviz@1.2.5.rbi +1333 -0
- data/sorbet/rbi/gems/ruby-openai@8.1.0.rbi +758 -0
- data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +9 -0
- data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +9 -0
- data/sorbet/rbi/gems/securerandom@0.4.1.rbi +75 -0
- data/sorbet/rbi/gems/shellany@0.0.1.rbi +102 -0
- data/sorbet/rbi/gems/spoom@1.6.3.rbi +6985 -0
- data/sorbet/rbi/gems/sqlite3@2.7.0.rbi +1900 -0
- data/sorbet/rbi/gems/tapioca@0.16.11.rbi +3628 -0
- data/sorbet/rbi/gems/thor@1.4.0.rbi +4399 -0
- data/sorbet/rbi/gems/tzinfo@2.0.6.rbi +5918 -0
- data/sorbet/rbi/gems/unicode-display_width@3.1.4.rbi +9 -0
- data/sorbet/rbi/gems/unicode-emoji@4.0.4.rbi +9 -0
- data/sorbet/rbi/gems/uri@1.0.3.rbi +2349 -0
- data/sorbet/rbi/gems/vcr@6.3.1.rbi +3040 -0
- data/sorbet/rbi/gems/webmock@3.25.1.rbi +1792 -0
- data/sorbet/rbi/gems/yard-sorbet@0.9.0.rbi +435 -0
- data/sorbet/rbi/gems/yard@0.9.37.rbi +18492 -0
- data/sorbet/rbi/gems/zeitwerk@2.7.3.rbi +1429 -0
- data/sorbet/tapioca/config.yml +13 -0
- data/sorbet/tapioca/require.rb +36 -0
- metadata +114 -2
- data/lib/roast/workflow/configuration_parser.rb +0 -54
@@ -0,0 +1,3969 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
# DO NOT EDIT MANUALLY
|
4
|
+
# This is an autogenerated file for types exported from the `dry-types` gem.
|
5
|
+
# Please instead update this file by running `bin/tapioca gem dry-types`.
|
6
|
+
|
7
|
+
|
8
|
+
# Main library namespace
|
9
|
+
#
|
10
|
+
# @api public
|
11
|
+
#
|
12
|
+
# source://dry-types//lib/dry/types/constraints.rb#3
|
13
|
+
module Dry
|
14
|
+
class << self
|
15
|
+
# source://dry-configurable/1.3.0/lib/dry/configurable.rb#11
|
16
|
+
def Configurable(**options); end
|
17
|
+
|
18
|
+
# source://dry-core/1.1.0/lib/dry/core.rb#52
|
19
|
+
def Equalizer(*keys, **options); end
|
20
|
+
|
21
|
+
# Export registered types as a module with constants
|
22
|
+
#
|
23
|
+
# @api public
|
24
|
+
# @example no options
|
25
|
+
#
|
26
|
+
# module Types
|
27
|
+
# # imports all types as constants, uses modules for namespaces
|
28
|
+
# include Dry.Types()
|
29
|
+
# end
|
30
|
+
# # strict types are exported by default
|
31
|
+
# Types::Integer
|
32
|
+
# # => #<Dry::Types[Constrained<Nominal<Integer> rule=[type?(Integer)]>]>
|
33
|
+
# Types::Nominal::Integer
|
34
|
+
# # => #<Dry::Types[Nominal<Integer>]>
|
35
|
+
# @example changing default types
|
36
|
+
#
|
37
|
+
# module Types
|
38
|
+
# include Dry.Types(default: :nominal)
|
39
|
+
# end
|
40
|
+
# Types::Integer
|
41
|
+
# # => #<Dry::Types[Nominal<Integer>]>
|
42
|
+
# @example cherry-picking namespaces
|
43
|
+
#
|
44
|
+
# module Types
|
45
|
+
# include Dry.Types(:strict, :coercible)
|
46
|
+
# end
|
47
|
+
# # cherry-picking discards default types,
|
48
|
+
# # provide the :default option along with the list of
|
49
|
+
# # namespaces if you want the to be exported
|
50
|
+
# Types.constants # => [:Coercible, :Strict]
|
51
|
+
# @example custom names
|
52
|
+
# module Types
|
53
|
+
# include Dry.Types(coercible: :Kernel)
|
54
|
+
# end
|
55
|
+
# Types::Kernel::Integer
|
56
|
+
# # => #<Dry::Types[Constructor<Nominal<Integer> fn=Kernel.Integer>]>
|
57
|
+
# @param namespaces [Array<Symbol>] List of type namespaces to export
|
58
|
+
# @param default [Symbol] Default namespace to export
|
59
|
+
# @param aliases [Hash{Symbol => Symbol}] Optional renamings, like strict: :Draconian
|
60
|
+
# @return [Dry::Types::Module]
|
61
|
+
# @see Dry::Types::Module
|
62
|
+
#
|
63
|
+
# source://dry-types//lib/dry/types.rb#253
|
64
|
+
def Types(*namespaces, default: T.unsafe(nil), **aliases); end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# @api public
|
69
|
+
# @see Dry.Types
|
70
|
+
#
|
71
|
+
# source://dry-types//lib/dry/types/constraints.rb#7
|
72
|
+
module Dry::Types
|
73
|
+
include ::Dry::Core::Constants
|
74
|
+
extend ::Dry::Core::Constants
|
75
|
+
extend ::Dry::Core::ClassAttributes
|
76
|
+
extend ::Dry::Core::Extensions
|
77
|
+
extend ::Dry::Core::Deprecations::Interface
|
78
|
+
|
79
|
+
class << self
|
80
|
+
# @api public
|
81
|
+
# @param options [Hash]
|
82
|
+
# @return [Dry::Logic::Rule]
|
83
|
+
#
|
84
|
+
# source://dry-types//lib/dry/types/constraints.rb#13
|
85
|
+
def Rule(options); end
|
86
|
+
|
87
|
+
# Get a built-in type by its name
|
88
|
+
#
|
89
|
+
# @api public
|
90
|
+
# @param name [String, Class]
|
91
|
+
# @return [Type, Class]
|
92
|
+
#
|
93
|
+
# source://dry-types//lib/dry/types.rb#115
|
94
|
+
def [](name); end
|
95
|
+
|
96
|
+
# @api private
|
97
|
+
#
|
98
|
+
# source://dry-types//lib/dry/types.rb#163
|
99
|
+
def const_missing(const); end
|
100
|
+
|
101
|
+
# Return container with registered built-in type objects
|
102
|
+
#
|
103
|
+
# @api private
|
104
|
+
# @return [Container{String => Nominal}]
|
105
|
+
#
|
106
|
+
# source://dry-types//lib/dry/types.rb#82
|
107
|
+
def container; end
|
108
|
+
|
109
|
+
# Add a new type builder method. This is a public API for defining custom
|
110
|
+
# type constructors
|
111
|
+
#
|
112
|
+
# @api public
|
113
|
+
# @example simple custom type constructor
|
114
|
+
# Dry::Types.define_builder(:or_nil) do |type|
|
115
|
+
# type.optional.fallback(nil)
|
116
|
+
# end
|
117
|
+
#
|
118
|
+
# Dry::Types["integer"].or_nil.("foo") # => nil
|
119
|
+
# @example fallback alias
|
120
|
+
# Dry::Types.define_builder(:or) do |type, fallback|
|
121
|
+
# type.fallback(fallback)
|
122
|
+
# end
|
123
|
+
#
|
124
|
+
# Dry::Types["integer"].or(100).("foo") # => 100
|
125
|
+
# @param method [Symbol]
|
126
|
+
# @param block [#call]
|
127
|
+
#
|
128
|
+
# source://dry-types//lib/dry/types.rb#197
|
129
|
+
def define_builder(method, &block); end
|
130
|
+
|
131
|
+
# Infer a type identifier from the provided class
|
132
|
+
#
|
133
|
+
# @api public
|
134
|
+
# @param klass [#to_s]
|
135
|
+
# @return [String]
|
136
|
+
#
|
137
|
+
# source://dry-types//lib/dry/types.rb#149
|
138
|
+
def identifier(klass); end
|
139
|
+
|
140
|
+
# @api private
|
141
|
+
# @private
|
142
|
+
#
|
143
|
+
# source://dry-types//lib/dry/types.rb#73
|
144
|
+
def included(*_arg0); end
|
145
|
+
|
146
|
+
# @api public
|
147
|
+
#
|
148
|
+
# source://dry-types//lib/dry/types.rb#33
|
149
|
+
def loader; end
|
150
|
+
|
151
|
+
# @api public
|
152
|
+
#
|
153
|
+
# source://dry-core/1.1.0/lib/dry/core/deprecations.rb#202
|
154
|
+
def module(*args, &block); end
|
155
|
+
|
156
|
+
# Register a new built-in type
|
157
|
+
#
|
158
|
+
# @api private
|
159
|
+
# @param name [String]
|
160
|
+
# @param type [Type]
|
161
|
+
# @param block [#call, nil]
|
162
|
+
# @return [Container{String => Nominal}]
|
163
|
+
#
|
164
|
+
# source://dry-types//lib/dry/types.rb#104
|
165
|
+
def register(name, type = T.unsafe(nil), &block); end
|
166
|
+
|
167
|
+
# Check if a give type is registered
|
168
|
+
#
|
169
|
+
# @api private
|
170
|
+
# @return [Boolean]
|
171
|
+
#
|
172
|
+
# source://dry-types//lib/dry/types.rb#91
|
173
|
+
def registered?(class_or_identifier); end
|
174
|
+
|
175
|
+
# @api private
|
176
|
+
# @return [Dry::Logic::RuleCompiler]
|
177
|
+
#
|
178
|
+
# source://dry-types//lib/dry/types/constraints.rb#26
|
179
|
+
def rule_compiler; end
|
180
|
+
|
181
|
+
# Cached type map
|
182
|
+
#
|
183
|
+
# @api private
|
184
|
+
# @return [Concurrent::Map]
|
185
|
+
#
|
186
|
+
# source://dry-types//lib/dry/types.rb#158
|
187
|
+
def type_map; end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
# All built-in primitives
|
192
|
+
#
|
193
|
+
# @api public
|
194
|
+
#
|
195
|
+
# source://dry-types//lib/dry/types/core.rb#38
|
196
|
+
Dry::Types::ALL_PRIMITIVES = T.let(T.unsafe(nil), Hash)
|
197
|
+
|
198
|
+
# source://dry-types//lib/dry/types/any.rb#39
|
199
|
+
Dry::Types::Any = T.let(T.unsafe(nil), Dry::Types::AnyClass)
|
200
|
+
|
201
|
+
# Any is a nominal type that defines Object as the primitive class
|
202
|
+
#
|
203
|
+
# This type is useful in places where you can't be specific about the type
|
204
|
+
# and anything is acceptable.
|
205
|
+
#
|
206
|
+
# @api public
|
207
|
+
#
|
208
|
+
# source://dry-types//lib/dry/types/any.rb#11
|
209
|
+
class Dry::Types::AnyClass < ::Dry::Types::Nominal
|
210
|
+
# @api private
|
211
|
+
# @return [AnyClass] a new instance of AnyClass
|
212
|
+
#
|
213
|
+
# source://dry-types//lib/dry/types/any.rb#15
|
214
|
+
def initialize(**options); end
|
215
|
+
|
216
|
+
# @api public
|
217
|
+
# @return [String]
|
218
|
+
#
|
219
|
+
# source://dry-types//lib/dry/types/any.rb#22
|
220
|
+
def name; end
|
221
|
+
|
222
|
+
# @api public
|
223
|
+
# @return [Array]
|
224
|
+
#
|
225
|
+
# source://dry-types//lib/dry/types/any.rb#36
|
226
|
+
def to_ast(meta: T.unsafe(nil)); end
|
227
|
+
|
228
|
+
# @api public
|
229
|
+
# @param new_options [Hash]
|
230
|
+
# @return [Type]
|
231
|
+
#
|
232
|
+
# source://dry-types//lib/dry/types/any.rb#29
|
233
|
+
def with(**new_options); end
|
234
|
+
|
235
|
+
class << self
|
236
|
+
# @api public
|
237
|
+
#
|
238
|
+
# source://dry-types//lib/dry/types/any.rb#12
|
239
|
+
def name; end
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
# Array type can be used to define an array with optional member type
|
244
|
+
#
|
245
|
+
# @api public
|
246
|
+
#
|
247
|
+
# source://dry-types//lib/dry/types/array.rb#8
|
248
|
+
class Dry::Types::Array < ::Dry::Types::Nominal
|
249
|
+
# @api private
|
250
|
+
#
|
251
|
+
# source://dry-types//lib/dry/types/array.rb#27
|
252
|
+
def constructor_type; end
|
253
|
+
|
254
|
+
# Build an array type with a member type
|
255
|
+
#
|
256
|
+
# @api public
|
257
|
+
# @param type [Type, #call]
|
258
|
+
# @return [Array::Member]
|
259
|
+
#
|
260
|
+
# source://dry-types//lib/dry/types/array.rb#16
|
261
|
+
def of(type); end
|
262
|
+
end
|
263
|
+
|
264
|
+
# @api private
|
265
|
+
#
|
266
|
+
# source://dry-types//lib/dry/types/array/constructor.rb#8
|
267
|
+
class Dry::Types::Array::Constructor < ::Dry::Types::Constructor
|
268
|
+
# @api private
|
269
|
+
#
|
270
|
+
# source://dry-types//lib/dry/types/array/constructor.rb#10
|
271
|
+
def constructor_type; end
|
272
|
+
|
273
|
+
# @api public
|
274
|
+
# @return [Lax]
|
275
|
+
#
|
276
|
+
# source://dry-types//lib/dry/types/array/constructor.rb#15
|
277
|
+
def lax; end
|
278
|
+
|
279
|
+
# @api public
|
280
|
+
# @see Dry::Types::Array#of
|
281
|
+
#
|
282
|
+
# source://dry-types//lib/dry/types/array/constructor.rb#20
|
283
|
+
def of(member); end
|
284
|
+
end
|
285
|
+
|
286
|
+
# Member arrays define their member type that is applied to each element
|
287
|
+
#
|
288
|
+
# @api public
|
289
|
+
#
|
290
|
+
# source://dry-types//lib/dry/types/array/member.rb#9
|
291
|
+
class Dry::Types::Array::Member < ::Dry::Types::Array
|
292
|
+
# @api private
|
293
|
+
# @option options
|
294
|
+
# @param primitive [Class]
|
295
|
+
# @param options [Hash]
|
296
|
+
# @return [Member] a new instance of Member
|
297
|
+
#
|
298
|
+
# source://dry-types//lib/dry/types/array/member.rb#19
|
299
|
+
def initialize(primitive, **options); end
|
300
|
+
|
301
|
+
# @api private
|
302
|
+
# @param input [Object]
|
303
|
+
# @return [Array]
|
304
|
+
#
|
305
|
+
# source://dry-types//lib/dry/types/array/member.rb#45
|
306
|
+
def call_safe(input); end
|
307
|
+
|
308
|
+
# @api private
|
309
|
+
# @param input [Object]
|
310
|
+
# @return [Array]
|
311
|
+
#
|
312
|
+
# source://dry-types//lib/dry/types/array/member.rb#29
|
313
|
+
def call_unsafe(input); end
|
314
|
+
|
315
|
+
# @api private
|
316
|
+
#
|
317
|
+
# source://dry-types//lib/dry/types/array/member.rb#116
|
318
|
+
def constructor_type; end
|
319
|
+
|
320
|
+
# Build a lax type
|
321
|
+
#
|
322
|
+
# @api public
|
323
|
+
# @return [Lax]
|
324
|
+
#
|
325
|
+
# source://dry-types//lib/dry/types/array/member.rb#100
|
326
|
+
def lax; end
|
327
|
+
|
328
|
+
# @api public
|
329
|
+
# @return [Type]
|
330
|
+
#
|
331
|
+
# source://dry-types//lib/dry/types/array/member.rb#11
|
332
|
+
def member; end
|
333
|
+
|
334
|
+
# @api public
|
335
|
+
# @see Nominal#to_ast
|
336
|
+
#
|
337
|
+
# source://dry-types//lib/dry/types/array/member.rb#107
|
338
|
+
def to_ast(meta: T.unsafe(nil)); end
|
339
|
+
|
340
|
+
# @api public
|
341
|
+
# @param input [Array, Object]
|
342
|
+
# @param block [#call, nil]
|
343
|
+
# @return [Result, Logic::Result]
|
344
|
+
# @yieldparam failure [Failure]
|
345
|
+
# @yieldreturn [Result]
|
346
|
+
#
|
347
|
+
# source://dry-types//lib/dry/types/array/member.rb#73
|
348
|
+
def try(input, &block); end
|
349
|
+
end
|
350
|
+
|
351
|
+
# Common API for building types and composition
|
352
|
+
#
|
353
|
+
# @api public
|
354
|
+
#
|
355
|
+
# source://dry-types//lib/dry/types/builder.rb#8
|
356
|
+
module Dry::Types::Builder
|
357
|
+
include ::Dry::Core::Constants
|
358
|
+
|
359
|
+
# Compose two types into an Intersection type
|
360
|
+
#
|
361
|
+
# @api private
|
362
|
+
# @param other [Type]
|
363
|
+
# @return [Intersection, Intersection::Constrained]
|
364
|
+
#
|
365
|
+
# source://dry-types//lib/dry/types/builder.rb#37
|
366
|
+
def &(other); end
|
367
|
+
|
368
|
+
# Define a constructor for the type
|
369
|
+
#
|
370
|
+
# @api public
|
371
|
+
# @param constructor [#call, nil]
|
372
|
+
# @param options [Hash]
|
373
|
+
# @param block [#call, nil]
|
374
|
+
# @return [Constructor]
|
375
|
+
#
|
376
|
+
# source://dry-types//lib/dry/types/builder.rb#138
|
377
|
+
def <<(constructor = T.unsafe(nil), **options, &block); end
|
378
|
+
|
379
|
+
# Compose two types into an Implication type
|
380
|
+
#
|
381
|
+
# @api private
|
382
|
+
# @param other [Type]
|
383
|
+
# @return [Implication, Implication::Constrained]
|
384
|
+
#
|
385
|
+
# source://dry-types//lib/dry/types/builder.rb#46
|
386
|
+
def >(other); end
|
387
|
+
|
388
|
+
# Define a constructor for the type
|
389
|
+
#
|
390
|
+
# @api public
|
391
|
+
# @param constructor [#call, nil]
|
392
|
+
# @param options [Hash]
|
393
|
+
# @param block [#call, nil]
|
394
|
+
# @return [Constructor]
|
395
|
+
#
|
396
|
+
# source://dry-types//lib/dry/types/builder.rb#138
|
397
|
+
def >>(constructor = T.unsafe(nil), **options, &block); end
|
398
|
+
|
399
|
+
# Define a constructor for the type
|
400
|
+
#
|
401
|
+
# @api public
|
402
|
+
# @param constructor [#call, nil]
|
403
|
+
# @param options [Hash]
|
404
|
+
# @param block [#call, nil]
|
405
|
+
# @return [Constructor]
|
406
|
+
#
|
407
|
+
# source://dry-types//lib/dry/types/builder.rb#138
|
408
|
+
def append(constructor = T.unsafe(nil), **options, &block); end
|
409
|
+
|
410
|
+
# Turn a type into a constrained type
|
411
|
+
#
|
412
|
+
# @api public
|
413
|
+
# @param options [Hash] constraining rule (see {Types.Rule})
|
414
|
+
# @return [Constrained]
|
415
|
+
#
|
416
|
+
# source://dry-types//lib/dry/types/builder.rb#62
|
417
|
+
def constrained(*_arg0, **_arg1, &_arg2); end
|
418
|
+
|
419
|
+
# @api private
|
420
|
+
# @return [Class]
|
421
|
+
#
|
422
|
+
# source://dry-types//lib/dry/types/builder.rb#14
|
423
|
+
def constrained_type; end
|
424
|
+
|
425
|
+
# Define a constructor for the type
|
426
|
+
#
|
427
|
+
# @api public
|
428
|
+
# @param constructor [#call, nil]
|
429
|
+
# @param options [Hash]
|
430
|
+
# @param block [#call, nil]
|
431
|
+
# @return [Constructor]
|
432
|
+
#
|
433
|
+
# source://dry-types//lib/dry/types/builder.rb#138
|
434
|
+
def constructor(constructor = T.unsafe(nil), **options, &block); end
|
435
|
+
|
436
|
+
# @api private
|
437
|
+
# @return [Class]
|
438
|
+
#
|
439
|
+
# source://dry-types//lib/dry/types/builder.rb#19
|
440
|
+
def constructor_type; end
|
441
|
+
|
442
|
+
# Turn a type into a type with a default value
|
443
|
+
#
|
444
|
+
# @api public
|
445
|
+
# @option [Boolean]
|
446
|
+
# @param input [Object]
|
447
|
+
# @param block [#call, nil]
|
448
|
+
# @param [Boolean] [Hash] a customizable set of options
|
449
|
+
# @raise [ConstraintError]
|
450
|
+
# @return [Default]
|
451
|
+
#
|
452
|
+
# source://dry-types//lib/dry/types/builder.rb#77
|
453
|
+
def default(input = T.unsafe(nil), options = T.unsafe(nil), &block); end
|
454
|
+
|
455
|
+
# Define an enum on top of the existing type
|
456
|
+
#
|
457
|
+
# @api public
|
458
|
+
# @param values [Array]
|
459
|
+
# @return [Enum]
|
460
|
+
#
|
461
|
+
# source://dry-types//lib/dry/types/builder.rb#110
|
462
|
+
def enum(*values); end
|
463
|
+
|
464
|
+
# Use the given value on type mismatch
|
465
|
+
#
|
466
|
+
# @api public
|
467
|
+
# @option [Boolean]
|
468
|
+
# @param value [Object]
|
469
|
+
# @param fallback [#call, nil]
|
470
|
+
# @param [Boolean] [Hash] a customizable set of options
|
471
|
+
# @return [Constructor]
|
472
|
+
#
|
473
|
+
# source://dry-types//lib/dry/types/builder.rb#155
|
474
|
+
def fallback(value = T.unsafe(nil), shared: T.unsafe(nil), &_fallback); end
|
475
|
+
|
476
|
+
# Turn a type into a lax type that will rescue from type-errors and
|
477
|
+
# return the original input
|
478
|
+
#
|
479
|
+
# @api public
|
480
|
+
# @return [Lax]
|
481
|
+
#
|
482
|
+
# source://dry-types//lib/dry/types/builder.rb#127
|
483
|
+
def lax; end
|
484
|
+
|
485
|
+
# Turn a type into an optional type
|
486
|
+
#
|
487
|
+
# @api public
|
488
|
+
# @return [Sum]
|
489
|
+
#
|
490
|
+
# source://dry-types//lib/dry/types/builder.rb#53
|
491
|
+
def optional; end
|
492
|
+
|
493
|
+
# Define a constructor for the type
|
494
|
+
#
|
495
|
+
# @api public
|
496
|
+
# @param constructor [#call, nil]
|
497
|
+
# @param options [Hash]
|
498
|
+
# @param block [#call, nil]
|
499
|
+
# @return [Constructor]
|
500
|
+
#
|
501
|
+
# source://dry-types//lib/dry/types/builder.rb#138
|
502
|
+
def prepend(constructor = T.unsafe(nil), **options, &block); end
|
503
|
+
|
504
|
+
# Compose two types into a Sum type
|
505
|
+
#
|
506
|
+
# @api private
|
507
|
+
# @param other [Type]
|
508
|
+
# @return [Sum, Sum::Constrained]
|
509
|
+
#
|
510
|
+
# source://dry-types//lib/dry/types/builder.rb#28
|
511
|
+
def |(other); end
|
512
|
+
|
513
|
+
private
|
514
|
+
|
515
|
+
# @api private
|
516
|
+
#
|
517
|
+
# source://dry-types//lib/dry/types/builder.rb#193
|
518
|
+
def compose(other, composition_class); end
|
519
|
+
end
|
520
|
+
|
521
|
+
# Common API for building type objects in a convenient way
|
522
|
+
#
|
523
|
+
# @api public
|
524
|
+
#
|
525
|
+
# source://dry-types//lib/dry/types/builder_methods.rb#9
|
526
|
+
module Dry::Types::BuilderMethods
|
527
|
+
# Build an array type.
|
528
|
+
#
|
529
|
+
# Shortcut for Array#of.
|
530
|
+
#
|
531
|
+
# @api public
|
532
|
+
# @example
|
533
|
+
# Types::Strings = Types.Array(Types::String)
|
534
|
+
# @param type [Dry::Types::Type]
|
535
|
+
# @return [Dry::Types::Array]
|
536
|
+
#
|
537
|
+
# source://dry-types//lib/dry/types/builder_methods.rb#26
|
538
|
+
def Array(type); end
|
539
|
+
|
540
|
+
# Build a type with a single value
|
541
|
+
# The equality check done with `equal?`
|
542
|
+
#
|
543
|
+
# @api public
|
544
|
+
# @param object [Object]
|
545
|
+
# @return [Dry::Types::Type]
|
546
|
+
#
|
547
|
+
# source://dry-types//lib/dry/types/builder_methods.rb#70
|
548
|
+
def Constant(object); end
|
549
|
+
|
550
|
+
# Build a constructor type
|
551
|
+
# If no constructor block given it uses .new method
|
552
|
+
#
|
553
|
+
# @api public
|
554
|
+
# @param klass [Class]
|
555
|
+
# @param cons [#call, nil] Value constructor
|
556
|
+
# @param block [#call, nil] Value constructor
|
557
|
+
# @return [Dry::Types::Type]
|
558
|
+
#
|
559
|
+
# source://dry-types//lib/dry/types/builder_methods.rb#80
|
560
|
+
def Constructor(klass, cons = T.unsafe(nil), &block); end
|
561
|
+
|
562
|
+
# Build a hash schema
|
563
|
+
#
|
564
|
+
# @api public
|
565
|
+
# @param type_map [Hash{Symbol => Dry::Types::Type}]
|
566
|
+
# @return [Dry::Types::Array]
|
567
|
+
#
|
568
|
+
# source://dry-types//lib/dry/types/builder_methods.rb#33
|
569
|
+
def Hash(type_map); end
|
570
|
+
|
571
|
+
# Build a type which values are instances of a given class
|
572
|
+
# Values are checked using `is_a?` call
|
573
|
+
#
|
574
|
+
# @api public
|
575
|
+
# @example
|
576
|
+
# Types::Error = Types.Instance(StandardError)
|
577
|
+
# Types::Error = Types.Strict(StandardError)
|
578
|
+
# Types.Strict(Integer) == Types::Strict::Int # => true
|
579
|
+
# @param klass [Class, Module] Class or module
|
580
|
+
# @return [Dry::Types::Type]
|
581
|
+
#
|
582
|
+
# source://dry-types//lib/dry/types/builder_methods.rb#46
|
583
|
+
def Instance(klass); end
|
584
|
+
|
585
|
+
# Builds a constrained nominal type accepting any value that
|
586
|
+
# responds to given methods
|
587
|
+
#
|
588
|
+
# @api public
|
589
|
+
# @example
|
590
|
+
# Types::Callable = Types.Interface(:call)
|
591
|
+
# Types::Contact = Types.Interface(:name, :address)
|
592
|
+
# @param methods [Array<String, Symbol>] Method names
|
593
|
+
# @return [Dry::Types::Contrained]
|
594
|
+
#
|
595
|
+
# source://dry-types//lib/dry/types/builder_methods.rb#131
|
596
|
+
def Interface(*methods); end
|
597
|
+
|
598
|
+
# Build a map type
|
599
|
+
#
|
600
|
+
# @api public
|
601
|
+
# @example
|
602
|
+
# Types::IntMap = Types.Map(Types::Strict::Integer, 'any')
|
603
|
+
# Types::IntStringMap = Types.Map(Types::Strict::Integer, Types::Strict::String)
|
604
|
+
# @param key_type [Type] Key type
|
605
|
+
# @param value_type [Type] Value type
|
606
|
+
# @return [Dry::Types::Map]
|
607
|
+
#
|
608
|
+
# source://dry-types//lib/dry/types/builder_methods.rb#117
|
609
|
+
def Map(key_type, value_type); end
|
610
|
+
|
611
|
+
# Build a nominal type
|
612
|
+
#
|
613
|
+
# @api public
|
614
|
+
# @param klass [Class]
|
615
|
+
# @return [Dry::Types::Type]
|
616
|
+
#
|
617
|
+
# source://dry-types//lib/dry/types/builder_methods.rb#97
|
618
|
+
def Nominal(klass); end
|
619
|
+
|
620
|
+
# Build a type which values are instances of a given class
|
621
|
+
# Values are checked using `is_a?` call
|
622
|
+
#
|
623
|
+
# @api public
|
624
|
+
# @example
|
625
|
+
# Types::Error = Types.Instance(StandardError)
|
626
|
+
# Types::Error = Types.Strict(StandardError)
|
627
|
+
# Types.Strict(Integer) == Types::Strict::Int # => true
|
628
|
+
# @param klass [Class, Module] Class or module
|
629
|
+
# @return [Dry::Types::Type]
|
630
|
+
#
|
631
|
+
# source://dry-types//lib/dry/types/builder_methods.rb#46
|
632
|
+
def Strict(klass); end
|
633
|
+
|
634
|
+
# Build a type with a single value
|
635
|
+
# The equality check done with `eql?`
|
636
|
+
#
|
637
|
+
# @api public
|
638
|
+
# @param value [Object]
|
639
|
+
# @return [Dry::Types::Type]
|
640
|
+
#
|
641
|
+
# source://dry-types//lib/dry/types/builder_methods.rb#62
|
642
|
+
def Value(value); end
|
643
|
+
|
644
|
+
# @api private
|
645
|
+
#
|
646
|
+
# source://dry-types//lib/dry/types/builder_methods.rb#11
|
647
|
+
def included(base); end
|
648
|
+
end
|
649
|
+
|
650
|
+
# All coercible types
|
651
|
+
#
|
652
|
+
# @api public
|
653
|
+
#
|
654
|
+
# source://dry-types//lib/dry/types/core.rb#43
|
655
|
+
Dry::Types::COERCIBLE = T.let(T.unsafe(nil), Hash)
|
656
|
+
|
657
|
+
# Base class for coercion errors raise by dry-types
|
658
|
+
#
|
659
|
+
# @api public
|
660
|
+
#
|
661
|
+
# source://dry-types//lib/dry/types/errors.rb#15
|
662
|
+
class Dry::Types::CoercionError < ::StandardError
|
663
|
+
# @api private
|
664
|
+
# @return [CoercionError] a new instance of CoercionError
|
665
|
+
#
|
666
|
+
# source://dry-types//lib/dry/types/errors.rb#35
|
667
|
+
def initialize(message, meta: T.unsafe(nil), backtrace: T.unsafe(nil)); end
|
668
|
+
|
669
|
+
# Metadata associated with the error
|
670
|
+
#
|
671
|
+
# @api public
|
672
|
+
# @return [Object]
|
673
|
+
#
|
674
|
+
# source://dry-types//lib/dry/types/errors.rb#32
|
675
|
+
def meta; end
|
676
|
+
|
677
|
+
class << self
|
678
|
+
# @api private
|
679
|
+
#
|
680
|
+
# source://dry-types//lib/dry/types/errors.rb#17
|
681
|
+
def handle(exception, meta: T.unsafe(nil)); end
|
682
|
+
end
|
683
|
+
end
|
684
|
+
|
685
|
+
# Common coercion functions used by the built-in `Params` and `JSON` types
|
686
|
+
#
|
687
|
+
# @api public
|
688
|
+
#
|
689
|
+
# source://dry-types//lib/dry/types/coercions.rb#8
|
690
|
+
module Dry::Types::Coercions
|
691
|
+
include ::Dry::Core::Constants
|
692
|
+
|
693
|
+
# @api public
|
694
|
+
# @param input [#to_str, Object]
|
695
|
+
# @return [Date, Object]
|
696
|
+
# @see Date.parse
|
697
|
+
#
|
698
|
+
# source://dry-types//lib/dry/types/coercions.rb#18
|
699
|
+
def to_date(input, &_arg1); end
|
700
|
+
|
701
|
+
# @api public
|
702
|
+
# @param input [#to_str, Object]
|
703
|
+
# @return [DateTime, Object]
|
704
|
+
# @see DateTime.parse
|
705
|
+
#
|
706
|
+
# source://dry-types//lib/dry/types/coercions.rb#41
|
707
|
+
def to_date_time(input, &_arg1); end
|
708
|
+
|
709
|
+
# @api public
|
710
|
+
# @param input [#to_sym, Object]
|
711
|
+
# @raise CoercionError
|
712
|
+
# @return [Symbol, Object]
|
713
|
+
#
|
714
|
+
# source://dry-types//lib/dry/types/coercions.rb#87
|
715
|
+
def to_symbol(input, &_arg1); end
|
716
|
+
|
717
|
+
# @api public
|
718
|
+
# @param input [#to_str, Object]
|
719
|
+
# @return [Time, Object]
|
720
|
+
# @see Time.parse
|
721
|
+
#
|
722
|
+
# source://dry-types//lib/dry/types/coercions.rb#64
|
723
|
+
def to_time(input, &_arg1); end
|
724
|
+
|
725
|
+
private
|
726
|
+
|
727
|
+
# Checks whether String is empty
|
728
|
+
#
|
729
|
+
# @api private
|
730
|
+
# @param value [String, Object]
|
731
|
+
# @return [Boolean]
|
732
|
+
#
|
733
|
+
# source://dry-types//lib/dry/types/coercions.rb#102
|
734
|
+
def empty_str?(value); end
|
735
|
+
end
|
736
|
+
|
737
|
+
# JSON-specific coercions
|
738
|
+
#
|
739
|
+
# @api public
|
740
|
+
#
|
741
|
+
# source://dry-types//lib/dry/types/coercions/json.rb#14
|
742
|
+
module Dry::Types::Coercions::JSON
|
743
|
+
extend ::Dry::Core::Constants
|
744
|
+
extend ::Dry::Types::Coercions
|
745
|
+
|
746
|
+
class << self
|
747
|
+
# @api public
|
748
|
+
# @param input [#to_d, Object]
|
749
|
+
# @raise CoercionError
|
750
|
+
# @return [BigDecimal, nil]
|
751
|
+
#
|
752
|
+
# source://dry-types//lib/dry/types/coercions/json.rb#41
|
753
|
+
def to_decimal(input, &_arg1); end
|
754
|
+
|
755
|
+
# @api public
|
756
|
+
# @param input [Object]
|
757
|
+
# @raise CoercionError
|
758
|
+
# @return [nil] if the input is nil
|
759
|
+
#
|
760
|
+
# source://dry-types//lib/dry/types/coercions/json.rb#24
|
761
|
+
def to_nil(input, &_arg1); end
|
762
|
+
end
|
763
|
+
end
|
764
|
+
|
765
|
+
# Params-specific coercions
|
766
|
+
#
|
767
|
+
# @api public
|
768
|
+
#
|
769
|
+
# source://dry-types//lib/dry/types/coercions/params.rb#12
|
770
|
+
module Dry::Types::Coercions::Params
|
771
|
+
extend ::Dry::Core::Constants
|
772
|
+
extend ::Dry::Types::Coercions
|
773
|
+
|
774
|
+
class << self
|
775
|
+
# @api public
|
776
|
+
# @param input [Array, String, Object]
|
777
|
+
# @raise CoercionError
|
778
|
+
# @return [Array, Object]
|
779
|
+
#
|
780
|
+
# source://dry-types//lib/dry/types/coercions/params.rb#135
|
781
|
+
def to_ary(input, &_arg1); end
|
782
|
+
|
783
|
+
# @api public
|
784
|
+
# @param input [#to_d, Object]
|
785
|
+
# @raise CoercionError
|
786
|
+
# @return [BigDecimal, nil, Object]
|
787
|
+
#
|
788
|
+
# source://dry-types//lib/dry/types/coercions/params.rb#116
|
789
|
+
def to_decimal(input, &_arg1); end
|
790
|
+
|
791
|
+
# @api public
|
792
|
+
# @param input [String, Object]
|
793
|
+
# @raise CoercionError
|
794
|
+
# @return [Boolean, Object]
|
795
|
+
# @see TRUE_VALUES
|
796
|
+
# @see FALSE_VALUES
|
797
|
+
#
|
798
|
+
# source://dry-types//lib/dry/types/coercions/params.rb#69
|
799
|
+
def to_false(input, &_arg1); end
|
800
|
+
|
801
|
+
# @api public
|
802
|
+
# @param input [#to_f, Object]
|
803
|
+
# @raise CoercionError
|
804
|
+
# @return [Float, nil, Object]
|
805
|
+
#
|
806
|
+
# source://dry-types//lib/dry/types/coercions/params.rb#103
|
807
|
+
def to_float(input, &_arg1); end
|
808
|
+
|
809
|
+
# @api public
|
810
|
+
# @param input [Hash, String, Object]
|
811
|
+
# @raise CoercionError
|
812
|
+
# @return [Hash, Object]
|
813
|
+
#
|
814
|
+
# source://dry-types//lib/dry/types/coercions/params.rb#154
|
815
|
+
def to_hash(input, &_arg1); end
|
816
|
+
|
817
|
+
# @api public
|
818
|
+
# @param input [#to_int, #to_i, Object]
|
819
|
+
# @raise CoercionError
|
820
|
+
# @return [Integer, nil, Object]
|
821
|
+
#
|
822
|
+
# source://dry-types//lib/dry/types/coercions/params.rb#86
|
823
|
+
def to_int(input, &_arg1); end
|
824
|
+
|
825
|
+
# @api public
|
826
|
+
# @param input [Object]
|
827
|
+
# @raise CoercionError
|
828
|
+
# @return [nil] if the input is an empty string or nil
|
829
|
+
#
|
830
|
+
# source://dry-types//lib/dry/types/coercions/params.rb#29
|
831
|
+
def to_nil(input, &_arg1); end
|
832
|
+
|
833
|
+
# @api public
|
834
|
+
# @param input [String, Object]
|
835
|
+
# @raise CoercionError
|
836
|
+
# @return [Boolean, Object]
|
837
|
+
# @see TRUE_VALUES
|
838
|
+
# @see FALSE_VALUES
|
839
|
+
#
|
840
|
+
# source://dry-types//lib/dry/types/coercions/params.rb#49
|
841
|
+
def to_true(input, &_arg1); end
|
842
|
+
end
|
843
|
+
end
|
844
|
+
|
845
|
+
# @api public
|
846
|
+
#
|
847
|
+
# source://dry-types//lib/dry/types/coercions/params.rb#15
|
848
|
+
Dry::Types::Coercions::Params::BOOLEAN_MAP = T.let(T.unsafe(nil), Hash)
|
849
|
+
|
850
|
+
# @api public
|
851
|
+
#
|
852
|
+
# source://dry-types//lib/dry/types/coercions/params.rb#14
|
853
|
+
Dry::Types::Coercions::Params::FALSE_VALUES = T.let(T.unsafe(nil), Array)
|
854
|
+
|
855
|
+
# @api public
|
856
|
+
#
|
857
|
+
# source://dry-types//lib/dry/types/coercions/params.rb#13
|
858
|
+
Dry::Types::Coercions::Params::TRUE_VALUES = T.let(T.unsafe(nil), Array)
|
859
|
+
|
860
|
+
# @api private
|
861
|
+
#
|
862
|
+
# source://dry-types//lib/dry/types/compiler.rb#6
|
863
|
+
class Dry::Types::Compiler
|
864
|
+
extend ::Dry::Core::Deprecations::Interface
|
865
|
+
|
866
|
+
# @api private
|
867
|
+
# @return [Compiler] a new instance of Compiler
|
868
|
+
#
|
869
|
+
# source://dry-types//lib/dry/types/compiler.rb#11
|
870
|
+
def initialize(registry); end
|
871
|
+
|
872
|
+
# @api private
|
873
|
+
#
|
874
|
+
# source://dry-types//lib/dry/types/compiler.rb#15
|
875
|
+
def call(ast); end
|
876
|
+
|
877
|
+
# @api private
|
878
|
+
#
|
879
|
+
# source://dry-types//lib/dry/types/compiler.rb#114
|
880
|
+
def compile_fn(fn); end
|
881
|
+
|
882
|
+
# @api private
|
883
|
+
#
|
884
|
+
# source://dry-types//lib/dry/types/compiler.rb#9
|
885
|
+
def registry; end
|
886
|
+
|
887
|
+
# @api private
|
888
|
+
#
|
889
|
+
# source://dry-types//lib/dry/types/compiler.rb#17
|
890
|
+
def visit(node); end
|
891
|
+
|
892
|
+
# @api private
|
893
|
+
#
|
894
|
+
# source://dry-types//lib/dry/types/compiler.rb#110
|
895
|
+
def visit_any(meta); end
|
896
|
+
|
897
|
+
# @api private
|
898
|
+
#
|
899
|
+
# source://dry-types//lib/dry/types/compiler.rb#59
|
900
|
+
def visit_array(node); end
|
901
|
+
|
902
|
+
# @api private
|
903
|
+
#
|
904
|
+
# source://dry-types//lib/dry/types/compiler.rb#22
|
905
|
+
def visit_constrained(node); end
|
906
|
+
|
907
|
+
# @api private
|
908
|
+
#
|
909
|
+
# source://dry-types//lib/dry/types/compiler.rb#28
|
910
|
+
def visit_constructor(node); end
|
911
|
+
|
912
|
+
# @api private
|
913
|
+
#
|
914
|
+
# source://dry-types//lib/dry/types/compiler.rb#100
|
915
|
+
def visit_enum(node); end
|
916
|
+
|
917
|
+
# @api private
|
918
|
+
#
|
919
|
+
# source://dry-types//lib/dry/types/compiler.rb#65
|
920
|
+
def visit_hash(node); end
|
921
|
+
|
922
|
+
# @api private
|
923
|
+
#
|
924
|
+
# source://dry-types//lib/dry/types/compiler.rb#80
|
925
|
+
def visit_json_array(node); end
|
926
|
+
|
927
|
+
# @api private
|
928
|
+
#
|
929
|
+
# source://dry-types//lib/dry/types/compiler.rb#75
|
930
|
+
def visit_json_hash(node); end
|
931
|
+
|
932
|
+
# @api private
|
933
|
+
#
|
934
|
+
# source://dry-types//lib/dry/types/compiler.rb#95
|
935
|
+
def visit_key(node); end
|
936
|
+
|
937
|
+
# @api private
|
938
|
+
#
|
939
|
+
# source://dry-types//lib/dry/types/compiler.rb#34
|
940
|
+
def visit_lax(node); end
|
941
|
+
|
942
|
+
# @api private
|
943
|
+
#
|
944
|
+
# source://dry-types//lib/dry/types/compiler.rb#105
|
945
|
+
def visit_map(node); end
|
946
|
+
|
947
|
+
# @api private
|
948
|
+
#
|
949
|
+
# source://dry-types//lib/dry/types/compiler.rb#39
|
950
|
+
def visit_nominal(node); end
|
951
|
+
|
952
|
+
# @api private
|
953
|
+
#
|
954
|
+
# source://dry-types//lib/dry/types/compiler.rb#90
|
955
|
+
def visit_params_array(node); end
|
956
|
+
|
957
|
+
# @api private
|
958
|
+
#
|
959
|
+
# source://dry-types//lib/dry/types/compiler.rb#85
|
960
|
+
def visit_params_hash(node); end
|
961
|
+
|
962
|
+
# @api private
|
963
|
+
#
|
964
|
+
# source://dry-types//lib/dry/types/compiler.rb#50
|
965
|
+
def visit_rule(node); end
|
966
|
+
|
967
|
+
# source://dry-core/1.1.0/lib/dry/core/deprecations.rb#168
|
968
|
+
def visit_safe(*args, &block); end
|
969
|
+
|
970
|
+
# @api private
|
971
|
+
#
|
972
|
+
# source://dry-types//lib/dry/types/compiler.rb#70
|
973
|
+
def visit_schema(node); end
|
974
|
+
|
975
|
+
# @api private
|
976
|
+
#
|
977
|
+
# source://dry-types//lib/dry/types/compiler.rb#54
|
978
|
+
def visit_sum(node); end
|
979
|
+
end
|
980
|
+
|
981
|
+
# source://dry-types//lib/dry/types/composition.rb#9
|
982
|
+
module Dry::Types::Composition
|
983
|
+
include ::Dry::Types::Type
|
984
|
+
include ::Dry::Core::Constants
|
985
|
+
include ::Dry::Types::Builder
|
986
|
+
include ::Dry::Types::Options
|
987
|
+
include ::Dry::Types::Meta
|
988
|
+
include ::Dry::Types::Printable
|
989
|
+
include ::Dry::Core::Equalizer::Methods
|
990
|
+
include ::Dry::Types::Composition::Constrained
|
991
|
+
|
992
|
+
# @api private
|
993
|
+
# @param left [Type]
|
994
|
+
# @param right [Type]
|
995
|
+
# @param options [Hash]
|
996
|
+
#
|
997
|
+
# source://dry-types//lib/dry/types/composition.rb#50
|
998
|
+
def initialize(left, right, **options); end
|
999
|
+
|
1000
|
+
# @api private
|
1001
|
+
# @param input [Object]
|
1002
|
+
# @raise [::NotImplementedError]
|
1003
|
+
# @return [Object]
|
1004
|
+
#
|
1005
|
+
# source://dry-types//lib/dry/types/composition.rb#88
|
1006
|
+
def call_safe(input, &_arg1); end
|
1007
|
+
|
1008
|
+
# @api private
|
1009
|
+
# @param input [Object]
|
1010
|
+
# @raise [::NotImplementedError]
|
1011
|
+
# @return [Object]
|
1012
|
+
#
|
1013
|
+
# source://dry-types//lib/dry/types/composition.rb#81
|
1014
|
+
def call_unsafe(input); end
|
1015
|
+
|
1016
|
+
# @api public
|
1017
|
+
# @return [false]
|
1018
|
+
#
|
1019
|
+
# source://dry-types//lib/dry/types/composition.rb#69
|
1020
|
+
def constrained?; end
|
1021
|
+
|
1022
|
+
# @api public
|
1023
|
+
# @return [false]
|
1024
|
+
#
|
1025
|
+
# source://dry-types//lib/dry/types/composition.rb#64
|
1026
|
+
def default?; end
|
1027
|
+
|
1028
|
+
# @api private
|
1029
|
+
#
|
1030
|
+
# source://dry-types//lib/dry/types/composition.rb#106
|
1031
|
+
def failure(input, _error = T.unsafe(nil)); end
|
1032
|
+
|
1033
|
+
# @return [Type]
|
1034
|
+
#
|
1035
|
+
# source://dry-types//lib/dry/types/composition.rb#22
|
1036
|
+
def left; end
|
1037
|
+
|
1038
|
+
# @api public
|
1039
|
+
# @return [String]
|
1040
|
+
#
|
1041
|
+
# source://dry-types//lib/dry/types/composition.rb#59
|
1042
|
+
def name; end
|
1043
|
+
|
1044
|
+
# @api public
|
1045
|
+
# @return [Boolean]
|
1046
|
+
#
|
1047
|
+
# source://dry-types//lib/dry/types/composition.rb#74
|
1048
|
+
def optional?; end
|
1049
|
+
|
1050
|
+
# @api private
|
1051
|
+
# @param value [Object]
|
1052
|
+
# @raise [::NotImplementedError]
|
1053
|
+
# @return [Boolean]
|
1054
|
+
#
|
1055
|
+
# source://dry-types//lib/dry/types/composition.rb#120
|
1056
|
+
def primitive?(value); end
|
1057
|
+
|
1058
|
+
# @return [Type]
|
1059
|
+
#
|
1060
|
+
# source://dry-types//lib/dry/types/composition.rb#25
|
1061
|
+
def right; end
|
1062
|
+
|
1063
|
+
# @api private
|
1064
|
+
#
|
1065
|
+
# source://dry-types//lib/dry/types/composition.rb#96
|
1066
|
+
def success(input); end
|
1067
|
+
|
1068
|
+
# @api public
|
1069
|
+
# @see Nominal#to_ast
|
1070
|
+
#
|
1071
|
+
# source://dry-types//lib/dry/types/composition.rb#125
|
1072
|
+
def to_ast(meta: T.unsafe(nil)); end
|
1073
|
+
|
1074
|
+
# Wrap the type with a proc
|
1075
|
+
#
|
1076
|
+
# @api public
|
1077
|
+
# @return [Proc]
|
1078
|
+
#
|
1079
|
+
# source://dry-types//lib/dry/types/composition.rb#135
|
1080
|
+
def to_proc; end
|
1081
|
+
|
1082
|
+
# @api public
|
1083
|
+
# @param input [Object]
|
1084
|
+
# @raise [::NotImplementedError]
|
1085
|
+
#
|
1086
|
+
# source://dry-types//lib/dry/types/composition.rb#93
|
1087
|
+
def try(input, &_arg1); end
|
1088
|
+
|
1089
|
+
class << self
|
1090
|
+
# @private
|
1091
|
+
#
|
1092
|
+
# source://dry-types//lib/dry/types/composition.rb#37
|
1093
|
+
def included(base); end
|
1094
|
+
end
|
1095
|
+
end
|
1096
|
+
|
1097
|
+
# source://dry-types//lib/dry/types/composition.rb#27
|
1098
|
+
module Dry::Types::Composition::Constrained
|
1099
|
+
# @return [Boolean]
|
1100
|
+
#
|
1101
|
+
# source://dry-types//lib/dry/types/composition.rb#32
|
1102
|
+
def constrained?; end
|
1103
|
+
|
1104
|
+
# source://dry-types//lib/dry/types/composition.rb#28
|
1105
|
+
def rule; end
|
1106
|
+
end
|
1107
|
+
|
1108
|
+
# Constrained types apply rules to the input
|
1109
|
+
#
|
1110
|
+
# @api public
|
1111
|
+
#
|
1112
|
+
# source://dry-types//lib/dry/types/constrained.rb#8
|
1113
|
+
class Dry::Types::Constrained
|
1114
|
+
include ::Dry::Types::Type
|
1115
|
+
include ::Dry::Types::Options
|
1116
|
+
include ::Dry::Types::Decorator
|
1117
|
+
include ::Dry::Core::Constants
|
1118
|
+
include ::Dry::Types::Builder
|
1119
|
+
include ::Dry::Types::Printable
|
1120
|
+
include ::Dry::Core::Equalizer::Methods
|
1121
|
+
|
1122
|
+
# @api public
|
1123
|
+
# @param type [Type]
|
1124
|
+
# @param options [Hash]
|
1125
|
+
# @return [Constrained] a new instance of Constrained
|
1126
|
+
#
|
1127
|
+
# source://dry-types//lib/dry/types/constrained.rb#23
|
1128
|
+
def initialize(type, **options); end
|
1129
|
+
|
1130
|
+
# @api public
|
1131
|
+
# @param value [Object]
|
1132
|
+
# @return [Boolean]
|
1133
|
+
#
|
1134
|
+
# source://dry-types//lib/dry/types/constrained.rb#108
|
1135
|
+
def ===(value); end
|
1136
|
+
|
1137
|
+
# @api private
|
1138
|
+
# @return [Object]
|
1139
|
+
#
|
1140
|
+
# source://dry-types//lib/dry/types/constrained.rb#44
|
1141
|
+
def call_safe(input, &_arg1); end
|
1142
|
+
|
1143
|
+
# @api private
|
1144
|
+
# @return [Object]
|
1145
|
+
#
|
1146
|
+
# source://dry-types//lib/dry/types/constrained.rb#31
|
1147
|
+
def call_unsafe(input); end
|
1148
|
+
|
1149
|
+
# @api public
|
1150
|
+
# @param *nullary_rules [Array<Symbol>] a list of rules that do not require an additional
|
1151
|
+
# argument (e.g., :odd)
|
1152
|
+
# @param **unary_rules [Hash] a list of rules that require an additional argument
|
1153
|
+
# (e.g., gt: 0)
|
1154
|
+
# The parameters are merger to create a rules hash provided to {Types.Rule} and combined
|
1155
|
+
# using {&} with previous {#rule}
|
1156
|
+
# @return [Constrained]
|
1157
|
+
# @see Dry::Logic::Operators#and
|
1158
|
+
#
|
1159
|
+
# source://dry-types//lib/dry/types/constrained.rb#90
|
1160
|
+
def constrained(*nullary_rules, **unary_rules); end
|
1161
|
+
|
1162
|
+
# @api public
|
1163
|
+
# @return [true]
|
1164
|
+
#
|
1165
|
+
# source://dry-types//lib/dry/types/constrained.rb#101
|
1166
|
+
def constrained?; end
|
1167
|
+
|
1168
|
+
# @api private
|
1169
|
+
#
|
1170
|
+
# source://dry-types//lib/dry/types/constrained.rb#123
|
1171
|
+
def constructor_type; end
|
1172
|
+
|
1173
|
+
# Build lax type. Constraints are not applicable to lax types hence unwrapping
|
1174
|
+
#
|
1175
|
+
# @api public
|
1176
|
+
# @return [Lax]
|
1177
|
+
#
|
1178
|
+
# source://dry-types//lib/dry/types/constrained.rb#114
|
1179
|
+
def lax; end
|
1180
|
+
|
1181
|
+
# @api public
|
1182
|
+
# @return [Dry::Logic::Rule]
|
1183
|
+
#
|
1184
|
+
# source://dry-types//lib/dry/types/constrained.rb#16
|
1185
|
+
def rule; end
|
1186
|
+
|
1187
|
+
# @api public
|
1188
|
+
# @see Nominal#to_ast
|
1189
|
+
#
|
1190
|
+
# source://dry-types//lib/dry/types/constrained.rb#118
|
1191
|
+
def to_ast(meta: T.unsafe(nil)); end
|
1192
|
+
|
1193
|
+
# Safe coercion attempt. It is similar to #call with a
|
1194
|
+
# block given but returns a Result instance with metadata
|
1195
|
+
# about errors (if any).
|
1196
|
+
#
|
1197
|
+
# @api public
|
1198
|
+
# @overload try
|
1199
|
+
# @overload try
|
1200
|
+
#
|
1201
|
+
# source://dry-types//lib/dry/types/constrained.rb#67
|
1202
|
+
def try(input, &_arg1); end
|
1203
|
+
|
1204
|
+
private
|
1205
|
+
|
1206
|
+
# @api private
|
1207
|
+
# @param response [Object]
|
1208
|
+
# @return [Boolean]
|
1209
|
+
#
|
1210
|
+
# source://dry-types//lib/dry/types/constrained.rb#132
|
1211
|
+
def decorate?(response); end
|
1212
|
+
|
1213
|
+
# @api private
|
1214
|
+
# @param positional_args [Array]
|
1215
|
+
# @return [Hash]
|
1216
|
+
#
|
1217
|
+
# source://dry-types//lib/dry/types/constrained.rb#139
|
1218
|
+
def parse_arguments(positional_arguments); end
|
1219
|
+
end
|
1220
|
+
|
1221
|
+
# Common coercion-related API for constrained types
|
1222
|
+
#
|
1223
|
+
# @api public
|
1224
|
+
#
|
1225
|
+
# source://dry-types//lib/dry/types/constrained/coercible.rb#9
|
1226
|
+
class Dry::Types::Constrained::Coercible < ::Dry::Types::Constrained
|
1227
|
+
# @api private
|
1228
|
+
# @return [Object]
|
1229
|
+
#
|
1230
|
+
# source://dry-types//lib/dry/types/constrained/coercible.rb#27
|
1231
|
+
def call_safe(input); end
|
1232
|
+
|
1233
|
+
# @api private
|
1234
|
+
# @return [Object]
|
1235
|
+
#
|
1236
|
+
# source://dry-types//lib/dry/types/constrained/coercible.rb#13
|
1237
|
+
def call_unsafe(input); end
|
1238
|
+
|
1239
|
+
# @api public
|
1240
|
+
# @see Dry::Types::Constrained#try
|
1241
|
+
#
|
1242
|
+
# source://dry-types//lib/dry/types/constrained/coercible.rb#40
|
1243
|
+
def try(input, &_arg1); end
|
1244
|
+
end
|
1245
|
+
|
1246
|
+
# @api public
|
1247
|
+
#
|
1248
|
+
# source://dry-types//lib/dry/types/errors.rb#112
|
1249
|
+
class Dry::Types::ConstraintError < ::Dry::Types::CoercionError
|
1250
|
+
# @api public
|
1251
|
+
# @param result [String, #to_s]
|
1252
|
+
# @param input [Object]
|
1253
|
+
# @return [ConstraintError] a new instance of ConstraintError
|
1254
|
+
#
|
1255
|
+
# source://dry-types//lib/dry/types/errors.rb#120
|
1256
|
+
def initialize(result, input); end
|
1257
|
+
|
1258
|
+
# @api public
|
1259
|
+
# @return [Object]
|
1260
|
+
#
|
1261
|
+
# source://dry-types//lib/dry/types/errors.rb#116
|
1262
|
+
def input; end
|
1263
|
+
|
1264
|
+
# @api public
|
1265
|
+
# @return [String]
|
1266
|
+
#
|
1267
|
+
# source://dry-types//lib/dry/types/errors.rb#132
|
1268
|
+
def message; end
|
1269
|
+
|
1270
|
+
# @api public
|
1271
|
+
# @return [String, #to_s]
|
1272
|
+
#
|
1273
|
+
# source://dry-types//lib/dry/types/errors.rb#114
|
1274
|
+
def result; end
|
1275
|
+
|
1276
|
+
# @api public
|
1277
|
+
# @return [String]
|
1278
|
+
#
|
1279
|
+
# source://dry-types//lib/dry/types/errors.rb#132
|
1280
|
+
def to_s; end
|
1281
|
+
end
|
1282
|
+
|
1283
|
+
# Constructor types apply a function to the input that is supposed to return
|
1284
|
+
# a new value. Coercion is a common use case for constructor types.
|
1285
|
+
#
|
1286
|
+
# @api public
|
1287
|
+
#
|
1288
|
+
# source://dry-types//lib/dry/types/constructor.rb#9
|
1289
|
+
class Dry::Types::Constructor < ::Dry::Types::Nominal
|
1290
|
+
# Instantiate a new constructor type instance
|
1291
|
+
#
|
1292
|
+
# @api private
|
1293
|
+
# @param type [Type]
|
1294
|
+
# @param fn [Function]
|
1295
|
+
# @param options [Hash]
|
1296
|
+
# @return [Constructor] a new instance of Constructor
|
1297
|
+
#
|
1298
|
+
# source://dry-types//lib/dry/types/constructor.rb#62
|
1299
|
+
def initialize(type, fn: T.unsafe(nil), **options); end
|
1300
|
+
|
1301
|
+
# Build a new constructor by prepending a block to the coercion function
|
1302
|
+
#
|
1303
|
+
# @api public
|
1304
|
+
# @param new_fn [#call, nil]
|
1305
|
+
# @param options [Hash]
|
1306
|
+
# @param block [#call, nil]
|
1307
|
+
# @return [Constructor]
|
1308
|
+
#
|
1309
|
+
# source://dry-types//lib/dry/types/constructor.rb#140
|
1310
|
+
def <<(new_fn = T.unsafe(nil), **options, &block); end
|
1311
|
+
|
1312
|
+
# Build a new constructor by appending a block to the coercion function
|
1313
|
+
#
|
1314
|
+
# @api public
|
1315
|
+
# @param new_fn [#call, nil]
|
1316
|
+
# @param options [Hash]
|
1317
|
+
# @param block [#call, nil]
|
1318
|
+
# @return [Constructor]
|
1319
|
+
#
|
1320
|
+
# source://dry-types//lib/dry/types/constructor.rb#107
|
1321
|
+
def >>(new_fn = T.unsafe(nil), **options, &block); end
|
1322
|
+
|
1323
|
+
# Build a new constructor by appending a block to the coercion function
|
1324
|
+
#
|
1325
|
+
# @api public
|
1326
|
+
# @param new_fn [#call, nil]
|
1327
|
+
# @param options [Hash]
|
1328
|
+
# @param block [#call, nil]
|
1329
|
+
# @return [Constructor]
|
1330
|
+
#
|
1331
|
+
# source://dry-types//lib/dry/types/constructor.rb#107
|
1332
|
+
def append(new_fn = T.unsafe(nil), **options, &block); end
|
1333
|
+
|
1334
|
+
# @api private
|
1335
|
+
# @return [Object]
|
1336
|
+
#
|
1337
|
+
# source://dry-types//lib/dry/types/constructor.rb#72
|
1338
|
+
def call_safe(input); end
|
1339
|
+
|
1340
|
+
# @api private
|
1341
|
+
# @return [Object]
|
1342
|
+
#
|
1343
|
+
# source://dry-types//lib/dry/types/constructor.rb#80
|
1344
|
+
def call_unsafe(input); end
|
1345
|
+
|
1346
|
+
# @api private
|
1347
|
+
# @return [Class]
|
1348
|
+
#
|
1349
|
+
# source://dry-types//lib/dry/types/constructor.rb#122
|
1350
|
+
def constrained_type; end
|
1351
|
+
|
1352
|
+
# Build a new constructor by appending a block to the coercion function
|
1353
|
+
#
|
1354
|
+
# @api public
|
1355
|
+
# @param new_fn [#call, nil]
|
1356
|
+
# @param options [Hash]
|
1357
|
+
# @param block [#call, nil]
|
1358
|
+
# @return [Constructor]
|
1359
|
+
#
|
1360
|
+
# source://dry-types//lib/dry/types/constructor.rb#107
|
1361
|
+
def constructor(new_fn = T.unsafe(nil), **options, &block); end
|
1362
|
+
|
1363
|
+
# @api public
|
1364
|
+
# @return [#call]
|
1365
|
+
#
|
1366
|
+
# source://dry-types//lib/dry/types/constructor.rb#13
|
1367
|
+
def fn; end
|
1368
|
+
|
1369
|
+
# Build a lax type
|
1370
|
+
#
|
1371
|
+
# @api public
|
1372
|
+
# @return [Lax]
|
1373
|
+
#
|
1374
|
+
# source://dry-types//lib/dry/types/constructor.rb#149
|
1375
|
+
def lax; end
|
1376
|
+
|
1377
|
+
# Build a new constructor by prepending a block to the coercion function
|
1378
|
+
#
|
1379
|
+
# @api public
|
1380
|
+
# @param new_fn [#call, nil]
|
1381
|
+
# @param options [Hash]
|
1382
|
+
# @param block [#call, nil]
|
1383
|
+
# @return [Constructor]
|
1384
|
+
#
|
1385
|
+
# source://dry-types//lib/dry/types/constructor.rb#140
|
1386
|
+
def prepend(new_fn = T.unsafe(nil), **options, &block); end
|
1387
|
+
|
1388
|
+
# @api public
|
1389
|
+
# @see Nominal#to_ast
|
1390
|
+
#
|
1391
|
+
# source://dry-types//lib/dry/types/constructor.rb#127
|
1392
|
+
def to_ast(meta: T.unsafe(nil)); end
|
1393
|
+
|
1394
|
+
# Wrap the type with a proc
|
1395
|
+
#
|
1396
|
+
# @api public
|
1397
|
+
# @return [Proc]
|
1398
|
+
#
|
1399
|
+
# source://dry-types//lib/dry/types/constructor.rb#156
|
1400
|
+
def to_proc; end
|
1401
|
+
|
1402
|
+
# @api public
|
1403
|
+
# @param input [Object]
|
1404
|
+
# @param block [#call, nil]
|
1405
|
+
# @return [Logic::Result, Types::Result]
|
1406
|
+
# @return [Object] if block given and try fails
|
1407
|
+
#
|
1408
|
+
# source://dry-types//lib/dry/types/constructor.rb#89
|
1409
|
+
def try(input, &_arg1); end
|
1410
|
+
|
1411
|
+
# @api public
|
1412
|
+
# @return [Type]
|
1413
|
+
#
|
1414
|
+
# source://dry-types//lib/dry/types/constructor.rb#16
|
1415
|
+
def type; end
|
1416
|
+
|
1417
|
+
private
|
1418
|
+
|
1419
|
+
# Delegates missing methods to {#type}
|
1420
|
+
#
|
1421
|
+
# @api private
|
1422
|
+
# @param method [Symbol]
|
1423
|
+
# @param args [Array]
|
1424
|
+
# @param block [#call, nil]
|
1425
|
+
#
|
1426
|
+
# source://dry-types//lib/dry/types/constructor.rb#176
|
1427
|
+
def method_missing(method, *_arg1, **_arg2, &_arg3); end
|
1428
|
+
|
1429
|
+
# @api private
|
1430
|
+
# @param meth [Symbol]
|
1431
|
+
# @param include_private [Boolean]
|
1432
|
+
# @return [Boolean]
|
1433
|
+
#
|
1434
|
+
# source://dry-types//lib/dry/types/constructor.rb#165
|
1435
|
+
def respond_to_missing?(meth, include_private = T.unsafe(nil)); end
|
1436
|
+
|
1437
|
+
class << self
|
1438
|
+
# @api public
|
1439
|
+
# @param input [Builder, Object]
|
1440
|
+
# @param options [Hash]
|
1441
|
+
# @param block [#call, nil]
|
1442
|
+
#
|
1443
|
+
# source://dry-types//lib/dry/types/constructor.rb#35
|
1444
|
+
def [](type, fn:, **options); end
|
1445
|
+
|
1446
|
+
# @api public
|
1447
|
+
# @param input [Builder, Object]
|
1448
|
+
# @param options [Hash]
|
1449
|
+
# @param block [#call, nil]
|
1450
|
+
#
|
1451
|
+
# source://dry-types//lib/dry/types/constructor.rb#25
|
1452
|
+
def new(input, fn: T.unsafe(nil), **options, &block); end
|
1453
|
+
|
1454
|
+
# @api private
|
1455
|
+
#
|
1456
|
+
# source://dry-types//lib/dry/types/constructor.rb#46
|
1457
|
+
def wrapper_type; end
|
1458
|
+
end
|
1459
|
+
end
|
1460
|
+
|
1461
|
+
# Function is used internally by Constructor types
|
1462
|
+
#
|
1463
|
+
# @api private
|
1464
|
+
#
|
1465
|
+
# source://dry-types//lib/dry/types/constructor/function.rb#11
|
1466
|
+
class Dry::Types::Constructor::Function
|
1467
|
+
include ::Dry::Core::Equalizer::Methods
|
1468
|
+
|
1469
|
+
# @api private
|
1470
|
+
# @return [Function] a new instance of Function
|
1471
|
+
#
|
1472
|
+
# source://dry-types//lib/dry/types/constructor/function.rb#167
|
1473
|
+
def initialize(fn); end
|
1474
|
+
|
1475
|
+
# @api private
|
1476
|
+
# @return [Function]
|
1477
|
+
#
|
1478
|
+
# source://dry-types//lib/dry/types/constructor/function.rb#196
|
1479
|
+
def <<(other); end
|
1480
|
+
|
1481
|
+
# @api private
|
1482
|
+
# @return [Function]
|
1483
|
+
#
|
1484
|
+
# source://dry-types//lib/dry/types/constructor/function.rb#190
|
1485
|
+
def >>(other); end
|
1486
|
+
|
1487
|
+
# @api private
|
1488
|
+
# @return [Object]
|
1489
|
+
#
|
1490
|
+
# source://dry-types//lib/dry/types/constructor/function.rb#172
|
1491
|
+
def [](input, &_arg1); end
|
1492
|
+
|
1493
|
+
# @api private
|
1494
|
+
# @return [Integer]
|
1495
|
+
#
|
1496
|
+
# source://dry-types//lib/dry/types/constructor/function.rb#176
|
1497
|
+
def arity; end
|
1498
|
+
|
1499
|
+
# @api private
|
1500
|
+
# @return [Object]
|
1501
|
+
#
|
1502
|
+
# source://dry-types//lib/dry/types/constructor/function.rb#172
|
1503
|
+
def call(input, &_arg1); end
|
1504
|
+
|
1505
|
+
# @api private
|
1506
|
+
#
|
1507
|
+
# source://dry-types//lib/dry/types/constructor/function.rb#165
|
1508
|
+
def fn; end
|
1509
|
+
|
1510
|
+
# @api private
|
1511
|
+
# @return [Array]
|
1512
|
+
#
|
1513
|
+
# source://dry-types//lib/dry/types/constructor/function.rb#181
|
1514
|
+
def to_ast; end
|
1515
|
+
|
1516
|
+
# @api private
|
1517
|
+
# @return [Boolean]
|
1518
|
+
#
|
1519
|
+
# source://dry-types//lib/dry/types/constructor/function.rb#178
|
1520
|
+
def wrapper?; end
|
1521
|
+
|
1522
|
+
class << self
|
1523
|
+
# Choose or build specialized invokation code for a callable
|
1524
|
+
#
|
1525
|
+
# @api private
|
1526
|
+
# @param fn [#call]
|
1527
|
+
# @raise [::ArgumentError]
|
1528
|
+
# @return [Function]
|
1529
|
+
#
|
1530
|
+
# source://dry-types//lib/dry/types/constructor/function.rb#135
|
1531
|
+
def [](fn); end
|
1532
|
+
|
1533
|
+
# @api private
|
1534
|
+
# @return [Boolean]
|
1535
|
+
#
|
1536
|
+
# source://dry-types//lib/dry/types/constructor/function.rb#152
|
1537
|
+
def yields_block?(fn); end
|
1538
|
+
end
|
1539
|
+
end
|
1540
|
+
|
1541
|
+
# Coercion via a method call on a known object
|
1542
|
+
#
|
1543
|
+
# @api private
|
1544
|
+
#
|
1545
|
+
# source://dry-types//lib/dry/types/constructor/function.rb#26
|
1546
|
+
class Dry::Types::Constructor::Function::MethodCall < ::Dry::Types::Constructor::Function
|
1547
|
+
# @api private
|
1548
|
+
# @return [MethodCall] a new instance of MethodCall
|
1549
|
+
#
|
1550
|
+
# source://dry-types//lib/dry/types/constructor/function.rb#110
|
1551
|
+
def initialize(fn); end
|
1552
|
+
|
1553
|
+
# @api private
|
1554
|
+
#
|
1555
|
+
# source://dry-types//lib/dry/types/constructor/function.rb#108
|
1556
|
+
def name; end
|
1557
|
+
|
1558
|
+
# @api private
|
1559
|
+
#
|
1560
|
+
# source://dry-types//lib/dry/types/constructor/function.rb#108
|
1561
|
+
def target; end
|
1562
|
+
|
1563
|
+
# @api private
|
1564
|
+
#
|
1565
|
+
# source://dry-types//lib/dry/types/constructor/function.rb#116
|
1566
|
+
def to_ast; end
|
1567
|
+
|
1568
|
+
class << self
|
1569
|
+
# @api private
|
1570
|
+
# @return [MethodCall]
|
1571
|
+
#
|
1572
|
+
# source://dry-types//lib/dry/types/constructor/function.rb#103
|
1573
|
+
def [](fn, safe); end
|
1574
|
+
|
1575
|
+
# Choose or build the base class
|
1576
|
+
#
|
1577
|
+
# @api private
|
1578
|
+
# @return [Function]
|
1579
|
+
#
|
1580
|
+
# source://dry-types//lib/dry/types/constructor/function.rb#32
|
1581
|
+
def call_class(method, public, safe); end
|
1582
|
+
end
|
1583
|
+
end
|
1584
|
+
|
1585
|
+
# Coercion via a private method call
|
1586
|
+
#
|
1587
|
+
# @api private
|
1588
|
+
#
|
1589
|
+
# source://dry-types//lib/dry/types/constructor/function.rb#85
|
1590
|
+
class Dry::Types::Constructor::Function::MethodCall::PrivateCall < ::Dry::Types::Constructor::Function::MethodCall
|
1591
|
+
# @api private
|
1592
|
+
#
|
1593
|
+
# source://dry-types//lib/dry/types/constructor/function.rb#86
|
1594
|
+
def call(input, &_arg1); end
|
1595
|
+
end
|
1596
|
+
|
1597
|
+
# Coercion via an unsafe private method call
|
1598
|
+
#
|
1599
|
+
# @api private
|
1600
|
+
#
|
1601
|
+
# source://dry-types//lib/dry/types/constructor/function.rb#92
|
1602
|
+
class Dry::Types::Constructor::Function::MethodCall::PrivateSafeCall < ::Dry::Types::Constructor::Function::MethodCall::PrivateCall
|
1603
|
+
# @api private
|
1604
|
+
#
|
1605
|
+
# source://dry-types//lib/dry/types/constructor/function.rb#93
|
1606
|
+
def call(input, &_arg1); end
|
1607
|
+
end
|
1608
|
+
|
1609
|
+
# Coercion with a publicly accessible method call
|
1610
|
+
#
|
1611
|
+
# @api private
|
1612
|
+
#
|
1613
|
+
# source://dry-types//lib/dry/types/constructor/function.rb#53
|
1614
|
+
class Dry::Types::Constructor::Function::MethodCall::PublicCall < ::Dry::Types::Constructor::Function::MethodCall
|
1615
|
+
class << self
|
1616
|
+
# Choose or build the interface
|
1617
|
+
#
|
1618
|
+
# @api private
|
1619
|
+
# @return [::Module]
|
1620
|
+
#
|
1621
|
+
# source://dry-types//lib/dry/types/constructor/function.rb#59
|
1622
|
+
def call_interface(method, safe); end
|
1623
|
+
end
|
1624
|
+
end
|
1625
|
+
|
1626
|
+
# Wrapper for unsafe coercion functions
|
1627
|
+
#
|
1628
|
+
# @api private
|
1629
|
+
#
|
1630
|
+
# source://dry-types//lib/dry/types/constructor/function.rb#15
|
1631
|
+
class Dry::Types::Constructor::Function::Safe < ::Dry::Types::Constructor::Function
|
1632
|
+
# @api private
|
1633
|
+
#
|
1634
|
+
# source://dry-types//lib/dry/types/constructor/function.rb#16
|
1635
|
+
def call(input, &_arg1); end
|
1636
|
+
end
|
1637
|
+
|
1638
|
+
# @api private
|
1639
|
+
#
|
1640
|
+
# source://dry-types//lib/dry/types/constructor/function.rb#119
|
1641
|
+
class Dry::Types::Constructor::Function::Wrapper < ::Dry::Types::Constructor::Function
|
1642
|
+
# @api private
|
1643
|
+
# @return [Object]
|
1644
|
+
#
|
1645
|
+
# source://dry-types//lib/dry/types/constructor/function.rb#121
|
1646
|
+
def [](input, type, &_arg2); end
|
1647
|
+
|
1648
|
+
# @api private
|
1649
|
+
#
|
1650
|
+
# source://dry-types//lib/dry/types/constructor/function.rb#128
|
1651
|
+
def arity; end
|
1652
|
+
|
1653
|
+
# @api private
|
1654
|
+
# @return [Object]
|
1655
|
+
#
|
1656
|
+
# source://dry-types//lib/dry/types/constructor/function.rb#121
|
1657
|
+
def call(input, type, &_arg2); end
|
1658
|
+
end
|
1659
|
+
|
1660
|
+
# @api public
|
1661
|
+
#
|
1662
|
+
# source://dry-types//lib/dry/types/constructor/wrapper.rb#7
|
1663
|
+
module Dry::Types::Constructor::Wrapper
|
1664
|
+
# Build a new constructor by prepending a block to the coercion function
|
1665
|
+
#
|
1666
|
+
# @api public
|
1667
|
+
# @param new_fn [#call, nil]
|
1668
|
+
# @param options [Hash]
|
1669
|
+
# @param block [#call, nil]
|
1670
|
+
# @return [Constructor]
|
1671
|
+
#
|
1672
|
+
# source://dry-types//lib/dry/types/constructor/wrapper.rb#56
|
1673
|
+
def <<(new_fn = T.unsafe(nil), **options, &block); end
|
1674
|
+
|
1675
|
+
# Define a constructor for the type
|
1676
|
+
#
|
1677
|
+
# @api public
|
1678
|
+
# @param constructor [#call, nil]
|
1679
|
+
# @param options [Hash]
|
1680
|
+
# @param block [#call, nil]
|
1681
|
+
# @return [Constructor]
|
1682
|
+
#
|
1683
|
+
# source://dry-types//lib/dry/types/builder.rb#138
|
1684
|
+
def >>(constructor = T.unsafe(nil), **options, &block); end
|
1685
|
+
|
1686
|
+
# Define a constructor for the type
|
1687
|
+
#
|
1688
|
+
# @api public
|
1689
|
+
# @param constructor [#call, nil]
|
1690
|
+
# @param options [Hash]
|
1691
|
+
# @param block [#call, nil]
|
1692
|
+
# @return [Constructor]
|
1693
|
+
#
|
1694
|
+
# source://dry-types//lib/dry/types/builder.rb#138
|
1695
|
+
def append(constructor = T.unsafe(nil), **options, &block); end
|
1696
|
+
|
1697
|
+
# @api private
|
1698
|
+
# @return [Object]
|
1699
|
+
#
|
1700
|
+
# source://dry-types//lib/dry/types/constructor/wrapper.rb#11
|
1701
|
+
def call_safe(input, &_arg1); end
|
1702
|
+
|
1703
|
+
# @api private
|
1704
|
+
# @return [Object]
|
1705
|
+
#
|
1706
|
+
# source://dry-types//lib/dry/types/constructor/wrapper.rb#16
|
1707
|
+
def call_unsafe(input); end
|
1708
|
+
|
1709
|
+
# Define a constructor for the type
|
1710
|
+
#
|
1711
|
+
# @api public
|
1712
|
+
# @param constructor [#call, nil]
|
1713
|
+
# @param options [Hash]
|
1714
|
+
# @param block [#call, nil]
|
1715
|
+
# @return [Constructor]
|
1716
|
+
#
|
1717
|
+
# source://dry-types//lib/dry/types/builder.rb#138
|
1718
|
+
def constructor(constructor = T.unsafe(nil), **options, &block); end
|
1719
|
+
|
1720
|
+
# @api public
|
1721
|
+
# @return [Constructor]
|
1722
|
+
#
|
1723
|
+
# source://dry-types//lib/dry/types/constructor/wrapper.rb#73
|
1724
|
+
def lax; end
|
1725
|
+
|
1726
|
+
# Build a new constructor by prepending a block to the coercion function
|
1727
|
+
#
|
1728
|
+
# @api public
|
1729
|
+
# @param new_fn [#call, nil]
|
1730
|
+
# @param options [Hash]
|
1731
|
+
# @param block [#call, nil]
|
1732
|
+
# @return [Constructor]
|
1733
|
+
#
|
1734
|
+
# source://dry-types//lib/dry/types/constructor/wrapper.rb#56
|
1735
|
+
def prepend(new_fn = T.unsafe(nil), **options, &block); end
|
1736
|
+
|
1737
|
+
# @api public
|
1738
|
+
# @param input [Object]
|
1739
|
+
# @param block [#call, nil]
|
1740
|
+
# @return [Logic::Result, Types::Result]
|
1741
|
+
# @return [Object] if block given and try fails
|
1742
|
+
#
|
1743
|
+
# source://dry-types//lib/dry/types/constructor/wrapper.rb#25
|
1744
|
+
def try(input, &_arg1); end
|
1745
|
+
|
1746
|
+
private
|
1747
|
+
|
1748
|
+
# Replace underlying type
|
1749
|
+
#
|
1750
|
+
# @api private
|
1751
|
+
#
|
1752
|
+
# source://dry-types//lib/dry/types/constructor/wrapper.rb#84
|
1753
|
+
def __new__(type); end
|
1754
|
+
end
|
1755
|
+
|
1756
|
+
# Internal container for the built-in types
|
1757
|
+
#
|
1758
|
+
# @api private
|
1759
|
+
#
|
1760
|
+
# source://dry-types//lib/dry/types/container.rb#8
|
1761
|
+
class Dry::Types::Container
|
1762
|
+
include ::Dry::Core::Container::Mixin::Initializer
|
1763
|
+
include ::Dry::Core::Container::Mixin
|
1764
|
+
extend ::Dry::Core::Container::Configuration
|
1765
|
+
extend ::Dry::Core::Constants
|
1766
|
+
extend ::Dry::Configurable
|
1767
|
+
extend ::Dry::Configurable::Methods
|
1768
|
+
extend ::Dry::Configurable::ClassMethods
|
1769
|
+
|
1770
|
+
# source://dry-core/1.1.0/lib/dry/core/container/mixin.rb#83
|
1771
|
+
def config; end
|
1772
|
+
end
|
1773
|
+
|
1774
|
+
# Common API for types
|
1775
|
+
#
|
1776
|
+
# @api public
|
1777
|
+
#
|
1778
|
+
# source://dry-types//lib/dry/types/decorator.rb#8
|
1779
|
+
module Dry::Types::Decorator
|
1780
|
+
include ::Dry::Types::Options
|
1781
|
+
|
1782
|
+
# @api public
|
1783
|
+
# @param type [Type]
|
1784
|
+
#
|
1785
|
+
# source://dry-types//lib/dry/types/decorator.rb#15
|
1786
|
+
def initialize(type, *_arg1, **_arg2); end
|
1787
|
+
|
1788
|
+
# @api public
|
1789
|
+
# @return [Boolean]
|
1790
|
+
#
|
1791
|
+
# source://dry-types//lib/dry/types/decorator.rb#37
|
1792
|
+
def constrained?; end
|
1793
|
+
|
1794
|
+
# @api public
|
1795
|
+
# @return [Boolean]
|
1796
|
+
#
|
1797
|
+
# source://dry-types//lib/dry/types/decorator.rb#32
|
1798
|
+
def default?; end
|
1799
|
+
|
1800
|
+
# Wrap the type with a proc
|
1801
|
+
#
|
1802
|
+
# @api public
|
1803
|
+
# @return [Proc]
|
1804
|
+
#
|
1805
|
+
# source://dry-types//lib/dry/types/decorator.rb#54
|
1806
|
+
def to_proc; end
|
1807
|
+
|
1808
|
+
# @api public
|
1809
|
+
# @param input [Object]
|
1810
|
+
# @param block [#call, nil]
|
1811
|
+
# @return [Result, Logic::Result]
|
1812
|
+
# @return [Object] if block given and try fails
|
1813
|
+
#
|
1814
|
+
# source://dry-types//lib/dry/types/decorator.rb#27
|
1815
|
+
def try(input, &_arg1); end
|
1816
|
+
|
1817
|
+
# @api public
|
1818
|
+
# @return [Type]
|
1819
|
+
#
|
1820
|
+
# source://dry-types//lib/dry/types/decorator.rb#12
|
1821
|
+
def type; end
|
1822
|
+
|
1823
|
+
private
|
1824
|
+
|
1825
|
+
# Replace underlying type
|
1826
|
+
#
|
1827
|
+
# @api private
|
1828
|
+
#
|
1829
|
+
# source://dry-types//lib/dry/types/decorator.rb#89
|
1830
|
+
def __new__(type); end
|
1831
|
+
|
1832
|
+
# @api private
|
1833
|
+
# @param response [Object]
|
1834
|
+
# @return [Boolean]
|
1835
|
+
#
|
1836
|
+
# source://dry-types//lib/dry/types/decorator.rb#63
|
1837
|
+
def decorate?(response); end
|
1838
|
+
|
1839
|
+
# Delegates missing methods to {#type}
|
1840
|
+
#
|
1841
|
+
# @api private
|
1842
|
+
# @param meth [Symbol]
|
1843
|
+
# @param args [Array]
|
1844
|
+
# @param block [#call, nil]
|
1845
|
+
#
|
1846
|
+
# source://dry-types//lib/dry/types/decorator.rb#72
|
1847
|
+
def method_missing(meth, *_arg1, **_arg2, &_arg3); end
|
1848
|
+
|
1849
|
+
# @api public
|
1850
|
+
# @param meth [Symbol]
|
1851
|
+
# @param include_private [Boolean]
|
1852
|
+
# @return [Boolean]
|
1853
|
+
#
|
1854
|
+
# source://dry-types//lib/dry/types/decorator.rb#45
|
1855
|
+
def respond_to_missing?(meth, include_private = T.unsafe(nil)); end
|
1856
|
+
end
|
1857
|
+
|
1858
|
+
# Default types are useful when a missing value should be replaced by a default one
|
1859
|
+
#
|
1860
|
+
# @api public
|
1861
|
+
#
|
1862
|
+
# source://dry-types//lib/dry/types/default.rb#8
|
1863
|
+
class Dry::Types::Default
|
1864
|
+
include ::Dry::Types::Type
|
1865
|
+
include ::Dry::Types::Options
|
1866
|
+
include ::Dry::Types::Decorator
|
1867
|
+
include ::Dry::Core::Constants
|
1868
|
+
include ::Dry::Types::Builder
|
1869
|
+
include ::Dry::Types::Printable
|
1870
|
+
include ::Dry::Core::Equalizer::Methods
|
1871
|
+
|
1872
|
+
# @api private
|
1873
|
+
# @param type [Type]
|
1874
|
+
# @param value [Object]
|
1875
|
+
# @return [Default] a new instance of Default
|
1876
|
+
#
|
1877
|
+
# source://dry-types//lib/dry/types/default.rb#53
|
1878
|
+
def initialize(type, value, **_arg2); end
|
1879
|
+
|
1880
|
+
# @api private
|
1881
|
+
# @param input [Object]
|
1882
|
+
# @return [Object] value passed through {#type} or {#default} value
|
1883
|
+
#
|
1884
|
+
# source://dry-types//lib/dry/types/default.rb#108
|
1885
|
+
def call_safe(input = T.unsafe(nil), &_arg1); end
|
1886
|
+
|
1887
|
+
# @api private
|
1888
|
+
# @param input [Object]
|
1889
|
+
# @return [Object] value passed through {#type} or {#default} value
|
1890
|
+
#
|
1891
|
+
# source://dry-types//lib/dry/types/default.rb#95
|
1892
|
+
def call_unsafe(input = T.unsafe(nil)); end
|
1893
|
+
|
1894
|
+
# @api private
|
1895
|
+
# @return [false]
|
1896
|
+
#
|
1897
|
+
# source://dry-types//lib/dry/types/default.rb#119
|
1898
|
+
def callable?; end
|
1899
|
+
|
1900
|
+
# Build a constrained type
|
1901
|
+
#
|
1902
|
+
# @api public
|
1903
|
+
# @param args [Array] see {Dry::Types::Builder#constrained}
|
1904
|
+
# @return [Default]
|
1905
|
+
#
|
1906
|
+
# source://dry-types//lib/dry/types/default.rb#65
|
1907
|
+
def constrained(*_arg0, **_arg1, &_arg2); end
|
1908
|
+
|
1909
|
+
# @api public
|
1910
|
+
# @return [true]
|
1911
|
+
#
|
1912
|
+
# source://dry-types//lib/dry/types/default.rb#70
|
1913
|
+
def default?; end
|
1914
|
+
|
1915
|
+
# @api public
|
1916
|
+
# @return [Object]
|
1917
|
+
#
|
1918
|
+
# source://dry-types//lib/dry/types/default.rb#32
|
1919
|
+
def evaluate; end
|
1920
|
+
|
1921
|
+
# @api public
|
1922
|
+
# @param input [Object]
|
1923
|
+
# @return [Result::Success]
|
1924
|
+
#
|
1925
|
+
# source://dry-types//lib/dry/types/default.rb#77
|
1926
|
+
def try(input = T.unsafe(nil), &_arg1); end
|
1927
|
+
|
1928
|
+
# @api public
|
1929
|
+
# @return [Boolean]
|
1930
|
+
#
|
1931
|
+
# source://dry-types//lib/dry/types/default.rb#88
|
1932
|
+
def valid?(value = T.unsafe(nil)); end
|
1933
|
+
|
1934
|
+
# @api public
|
1935
|
+
# @return [Object]
|
1936
|
+
#
|
1937
|
+
# source://dry-types//lib/dry/types/default.rb#32
|
1938
|
+
def value; end
|
1939
|
+
|
1940
|
+
class << self
|
1941
|
+
# @api private
|
1942
|
+
# @param value [Object, #call]
|
1943
|
+
# @return [Class] {Default} or {Default::Callable}
|
1944
|
+
#
|
1945
|
+
# source://dry-types//lib/dry/types/default.rb#41
|
1946
|
+
def [](value); end
|
1947
|
+
end
|
1948
|
+
end
|
1949
|
+
|
1950
|
+
# @api private
|
1951
|
+
#
|
1952
|
+
# source://dry-types//lib/dry/types/default.rb#10
|
1953
|
+
class Dry::Types::Default::Callable < ::Dry::Types::Default
|
1954
|
+
# @api private
|
1955
|
+
# @return [true]
|
1956
|
+
#
|
1957
|
+
# source://dry-types//lib/dry/types/default.rb#20
|
1958
|
+
def callable?; end
|
1959
|
+
|
1960
|
+
# Evaluates given callable
|
1961
|
+
#
|
1962
|
+
# @api private
|
1963
|
+
# @return [Object]
|
1964
|
+
#
|
1965
|
+
# source://dry-types//lib/dry/types/default.rb#15
|
1966
|
+
def evaluate; end
|
1967
|
+
end
|
1968
|
+
|
1969
|
+
# @api public
|
1970
|
+
Dry::Types::Definition = Dry::Types::Nominal
|
1971
|
+
|
1972
|
+
# Enum types can be used to define an enum on top of an existing type
|
1973
|
+
#
|
1974
|
+
# @api public
|
1975
|
+
#
|
1976
|
+
# source://dry-types//lib/dry/types/enum.rb#8
|
1977
|
+
class Dry::Types::Enum
|
1978
|
+
include ::Dry::Types::Type
|
1979
|
+
include ::Dry::Core::Equalizer::Methods
|
1980
|
+
include ::Dry::Types::Options
|
1981
|
+
include ::Dry::Types::Decorator
|
1982
|
+
include ::Dry::Core::Constants
|
1983
|
+
include ::Dry::Types::Builder
|
1984
|
+
|
1985
|
+
# @api private
|
1986
|
+
# @option options
|
1987
|
+
# @param type [Type]
|
1988
|
+
# @param options [Hash]
|
1989
|
+
# @return [Enum] a new instance of Enum
|
1990
|
+
#
|
1991
|
+
# source://dry-types//lib/dry/types/enum.rb#28
|
1992
|
+
def initialize(type, **options); end
|
1993
|
+
|
1994
|
+
# @api private
|
1995
|
+
# @return [Object]
|
1996
|
+
#
|
1997
|
+
# source://dry-types//lib/dry/types/enum.rb#44
|
1998
|
+
def call_safe(input, &_arg1); end
|
1999
|
+
|
2000
|
+
# @api private
|
2001
|
+
# @return [Object]
|
2002
|
+
#
|
2003
|
+
# source://dry-types//lib/dry/types/enum.rb#39
|
2004
|
+
def call_unsafe(input); end
|
2005
|
+
|
2006
|
+
# @api private
|
2007
|
+
#
|
2008
|
+
# source://dry-types//lib/dry/types/enum.rb#52
|
2009
|
+
def default(*_arg0); end
|
2010
|
+
|
2011
|
+
# Iterate over each enum value
|
2012
|
+
#
|
2013
|
+
# @api public
|
2014
|
+
# @return [Array, Enumerator]
|
2015
|
+
#
|
2016
|
+
# source://dry-types//lib/dry/types/enum.rb#77
|
2017
|
+
def each_value(&_arg0); end
|
2018
|
+
|
2019
|
+
# Check whether a value is in the enum
|
2020
|
+
#
|
2021
|
+
# @api public
|
2022
|
+
#
|
2023
|
+
# source://dry-types//lib/dry/types/type.rb#18
|
2024
|
+
def include?(input = T.unsafe(nil)); end
|
2025
|
+
|
2026
|
+
# @api public
|
2027
|
+
# @return [String]
|
2028
|
+
#
|
2029
|
+
# source://dry-types//lib/dry/types/enum.rb#70
|
2030
|
+
def inspect; end
|
2031
|
+
|
2032
|
+
# @api public
|
2033
|
+
# @return [Hash]
|
2034
|
+
#
|
2035
|
+
# source://dry-types//lib/dry/types/enum.rb#21
|
2036
|
+
def inverted_mapping; end
|
2037
|
+
|
2038
|
+
# @api private
|
2039
|
+
# @return [String]
|
2040
|
+
#
|
2041
|
+
# source://dry-types//lib/dry/types/enum.rb#91
|
2042
|
+
def joined_values; end
|
2043
|
+
|
2044
|
+
# @api public
|
2045
|
+
# @return [Hash]
|
2046
|
+
#
|
2047
|
+
# source://dry-types//lib/dry/types/enum.rb#18
|
2048
|
+
def mapping; end
|
2049
|
+
|
2050
|
+
# @api public
|
2051
|
+
# @return [String]
|
2052
|
+
#
|
2053
|
+
# source://dry-types//lib/dry/types/enum.rb#86
|
2054
|
+
def name; end
|
2055
|
+
|
2056
|
+
# @api public
|
2057
|
+
# @see Nominal#to_ast
|
2058
|
+
#
|
2059
|
+
# source://dry-types//lib/dry/types/enum.rb#63
|
2060
|
+
def to_ast(meta: T.unsafe(nil)); end
|
2061
|
+
|
2062
|
+
# @api public
|
2063
|
+
# @return [String]
|
2064
|
+
#
|
2065
|
+
# source://dry-types//lib/dry/types/enum.rb#70
|
2066
|
+
def to_s; end
|
2067
|
+
|
2068
|
+
# @api public
|
2069
|
+
# @see Dry::Types::Constrained#try
|
2070
|
+
#
|
2071
|
+
# source://dry-types//lib/dry/types/enum.rb#49
|
2072
|
+
def try(input, &_arg1); end
|
2073
|
+
|
2074
|
+
# @api public
|
2075
|
+
# @return [Array]
|
2076
|
+
#
|
2077
|
+
# source://dry-types//lib/dry/types/enum.rb#15
|
2078
|
+
def values; end
|
2079
|
+
|
2080
|
+
private
|
2081
|
+
|
2082
|
+
# Maps a value
|
2083
|
+
#
|
2084
|
+
# @api private
|
2085
|
+
# @param input [Object]
|
2086
|
+
# @return [Object]
|
2087
|
+
#
|
2088
|
+
# source://dry-types//lib/dry/types/enum.rb#110
|
2089
|
+
def map_value(input); end
|
2090
|
+
end
|
2091
|
+
|
2092
|
+
# Internal container for constructor functions used by the built-in types
|
2093
|
+
#
|
2094
|
+
# @api private
|
2095
|
+
#
|
2096
|
+
# source://dry-types//lib/dry/types/fn_container.rb#8
|
2097
|
+
class Dry::Types::FnContainer
|
2098
|
+
class << self
|
2099
|
+
# @api private
|
2100
|
+
#
|
2101
|
+
# source://dry-types//lib/dry/types/fn_container.rb#23
|
2102
|
+
def [](fn_name); end
|
2103
|
+
|
2104
|
+
# @api private
|
2105
|
+
#
|
2106
|
+
# source://dry-types//lib/dry/types/fn_container.rb#10
|
2107
|
+
def container; end
|
2108
|
+
|
2109
|
+
# @api private
|
2110
|
+
#
|
2111
|
+
# source://dry-types//lib/dry/types/fn_container.rb#15
|
2112
|
+
def register(function = T.unsafe(nil), &block); end
|
2113
|
+
|
2114
|
+
# @api private
|
2115
|
+
#
|
2116
|
+
# source://dry-types//lib/dry/types/fn_container.rb#32
|
2117
|
+
def register_name(function); end
|
2118
|
+
end
|
2119
|
+
end
|
2120
|
+
|
2121
|
+
# Hash types can be used to define maps and schemas
|
2122
|
+
#
|
2123
|
+
# @api public
|
2124
|
+
#
|
2125
|
+
# source://dry-types//lib/dry/types/hash.rb#8
|
2126
|
+
class Dry::Types::Hash < ::Dry::Types::Nominal
|
2127
|
+
# @api private
|
2128
|
+
#
|
2129
|
+
# source://dry-types//lib/dry/types/hash.rb#77
|
2130
|
+
def constructor_type; end
|
2131
|
+
|
2132
|
+
# Build a map type
|
2133
|
+
#
|
2134
|
+
# @api public
|
2135
|
+
# @param key_type [Type]
|
2136
|
+
# @param value_type [Type]
|
2137
|
+
# @return [Map]
|
2138
|
+
#
|
2139
|
+
# source://dry-types//lib/dry/types/hash.rb#40
|
2140
|
+
def map(key_type, value_type); end
|
2141
|
+
|
2142
|
+
# @api private
|
2143
|
+
#
|
2144
|
+
# source://dry-types//lib/dry/types/hash.rb#50
|
2145
|
+
def permissive(*_arg0); end
|
2146
|
+
|
2147
|
+
# @api public
|
2148
|
+
# @overload schema
|
2149
|
+
# @overload schema
|
2150
|
+
#
|
2151
|
+
# source://dry-types//lib/dry/types/hash.rb#22
|
2152
|
+
def schema(keys_or_map, meta = T.unsafe(nil)); end
|
2153
|
+
|
2154
|
+
# @api private
|
2155
|
+
#
|
2156
|
+
# source://dry-types//lib/dry/types/hash.rb#50
|
2157
|
+
def strict(*_arg0); end
|
2158
|
+
|
2159
|
+
# @api private
|
2160
|
+
#
|
2161
|
+
# source://dry-types//lib/dry/types/hash.rb#50
|
2162
|
+
def strict_with_defaults(*_arg0); end
|
2163
|
+
|
2164
|
+
# @api private
|
2165
|
+
#
|
2166
|
+
# source://dry-types//lib/dry/types/hash.rb#50
|
2167
|
+
def symbolized(*_arg0); end
|
2168
|
+
|
2169
|
+
# @api public
|
2170
|
+
# @param meta [Boolean] Whether to dump the meta to the AST
|
2171
|
+
# @return [Array] An AST representation
|
2172
|
+
#
|
2173
|
+
# source://dry-types//lib/dry/types/hash.rb#95
|
2174
|
+
def to_ast(meta: T.unsafe(nil)); end
|
2175
|
+
|
2176
|
+
# Whether the type transforms types of schemas created by {Dry::Types::Hash#schema}
|
2177
|
+
#
|
2178
|
+
# @api public
|
2179
|
+
# @return [Boolean]
|
2180
|
+
#
|
2181
|
+
# source://dry-types//lib/dry/types/hash.rb#86
|
2182
|
+
def transform_types?; end
|
2183
|
+
|
2184
|
+
# @api private
|
2185
|
+
#
|
2186
|
+
# source://dry-types//lib/dry/types/hash.rb#50
|
2187
|
+
def weak(*_arg0); end
|
2188
|
+
|
2189
|
+
# Injects a type transformation function for building schemas
|
2190
|
+
#
|
2191
|
+
# @api public
|
2192
|
+
# @param proc [#call, nil]
|
2193
|
+
# @param block [#call, nil]
|
2194
|
+
# @raise [::ArgumentError]
|
2195
|
+
# @return [Hash]
|
2196
|
+
#
|
2197
|
+
# source://dry-types//lib/dry/types/hash.rb#67
|
2198
|
+
def with_type_transform(proc = T.unsafe(nil), &block); end
|
2199
|
+
|
2200
|
+
private
|
2201
|
+
|
2202
|
+
# @api private
|
2203
|
+
#
|
2204
|
+
# source://dry-types//lib/dry/types/hash.rb#104
|
2205
|
+
def build_keys(type_map); end
|
2206
|
+
|
2207
|
+
# @api private
|
2208
|
+
#
|
2209
|
+
# source://dry-types//lib/dry/types/hash.rb#125
|
2210
|
+
def key_name(key); end
|
2211
|
+
|
2212
|
+
# @api private
|
2213
|
+
#
|
2214
|
+
# source://dry-types//lib/dry/types/hash.rb#116
|
2215
|
+
def resolve_type(type); end
|
2216
|
+
end
|
2217
|
+
|
2218
|
+
# @api public
|
2219
|
+
#
|
2220
|
+
# source://dry-types//lib/dry/types/hash/constructor.rb#9
|
2221
|
+
class Dry::Types::Hash::Constructor < ::Dry::Types::Constructor
|
2222
|
+
# @api private
|
2223
|
+
#
|
2224
|
+
# source://dry-types//lib/dry/types/hash/constructor.rb#11
|
2225
|
+
def constructor_type; end
|
2226
|
+
|
2227
|
+
# @api public
|
2228
|
+
# @return [Lax]
|
2229
|
+
#
|
2230
|
+
# source://dry-types//lib/dry/types/hash/constructor.rb#16
|
2231
|
+
def lax; end
|
2232
|
+
|
2233
|
+
# @api public
|
2234
|
+
# @see Dry::Types::Array#of
|
2235
|
+
#
|
2236
|
+
# source://dry-types//lib/dry/types/hash/constructor.rb#21
|
2237
|
+
def schema(*_arg0, **_arg1, &_arg2); end
|
2238
|
+
end
|
2239
|
+
|
2240
|
+
# @api public
|
2241
|
+
#
|
2242
|
+
# source://dry-types//lib/dry/types/hash.rb#9
|
2243
|
+
Dry::Types::Hash::NOT_REQUIRED = T.let(T.unsafe(nil), Hash)
|
2244
|
+
|
2245
|
+
# Implication type
|
2246
|
+
#
|
2247
|
+
# @api public
|
2248
|
+
#
|
2249
|
+
# source://dry-types//lib/dry/types/implication.rb#8
|
2250
|
+
class Dry::Types::Implication
|
2251
|
+
include ::Dry::Types::Type
|
2252
|
+
include ::Dry::Core::Constants
|
2253
|
+
include ::Dry::Types::Builder
|
2254
|
+
include ::Dry::Types::Options
|
2255
|
+
include ::Dry::Types::Meta
|
2256
|
+
include ::Dry::Types::Printable
|
2257
|
+
include ::Dry::Core::Equalizer::Methods
|
2258
|
+
include ::Dry::Types::Composition
|
2259
|
+
|
2260
|
+
# @api private
|
2261
|
+
# @param input [Object]
|
2262
|
+
# @return [Object]
|
2263
|
+
#
|
2264
|
+
# source://dry-types//lib/dry/types/implication.rb#31
|
2265
|
+
def call_safe(input, &_arg1); end
|
2266
|
+
|
2267
|
+
# @api private
|
2268
|
+
# @param input [Object]
|
2269
|
+
# @return [Object]
|
2270
|
+
#
|
2271
|
+
# source://dry-types//lib/dry/types/implication.rb#18
|
2272
|
+
def call_unsafe(input); end
|
2273
|
+
|
2274
|
+
# @api private
|
2275
|
+
# @param value [Object]
|
2276
|
+
# @return [Boolean]
|
2277
|
+
#
|
2278
|
+
# source://dry-types//lib/dry/types/implication.rb#55
|
2279
|
+
def primitive?(value); end
|
2280
|
+
|
2281
|
+
# @api public
|
2282
|
+
# @param input [Object]
|
2283
|
+
#
|
2284
|
+
# source://dry-types//lib/dry/types/implication.rb#42
|
2285
|
+
def try(input, &_arg1); end
|
2286
|
+
|
2287
|
+
class << self
|
2288
|
+
# source://dry-types//lib/dry/types/composition.rb#40
|
2289
|
+
def ast_type; end
|
2290
|
+
|
2291
|
+
# source://dry-types//lib/dry/types/composition.rb#41
|
2292
|
+
def composition_name; end
|
2293
|
+
|
2294
|
+
# @api public
|
2295
|
+
#
|
2296
|
+
# source://dry-types//lib/dry/types/implication.rb#11
|
2297
|
+
def operator; end
|
2298
|
+
end
|
2299
|
+
end
|
2300
|
+
|
2301
|
+
# source://dry-types//lib/dry/types/implication.rb#0
|
2302
|
+
class Dry::Types::Implication::Constrained < ::Dry::Types::Implication
|
2303
|
+
include ::Dry::Types::Composition::Constrained
|
2304
|
+
end
|
2305
|
+
|
2306
|
+
# @api public
|
2307
|
+
#
|
2308
|
+
# source://dry-types//lib/dry/types/inflector.rb#7
|
2309
|
+
Dry::Types::Inflector = T.let(T.unsafe(nil), Dry::Inflector)
|
2310
|
+
|
2311
|
+
# Intersection type
|
2312
|
+
#
|
2313
|
+
# @api public
|
2314
|
+
#
|
2315
|
+
# source://dry-types//lib/dry/types/intersection.rb#12
|
2316
|
+
class Dry::Types::Intersection
|
2317
|
+
include ::Dry::Types::Type
|
2318
|
+
include ::Dry::Core::Constants
|
2319
|
+
include ::Dry::Types::Builder
|
2320
|
+
include ::Dry::Types::Options
|
2321
|
+
include ::Dry::Types::Meta
|
2322
|
+
include ::Dry::Types::Printable
|
2323
|
+
include ::Dry::Core::Equalizer::Methods
|
2324
|
+
include ::Dry::Types::Composition
|
2325
|
+
|
2326
|
+
# @api private
|
2327
|
+
# @param input [Object]
|
2328
|
+
# @return [Object]
|
2329
|
+
#
|
2330
|
+
# source://dry-types//lib/dry/types/intersection.rb#31
|
2331
|
+
def call_safe(input, &_arg1); end
|
2332
|
+
|
2333
|
+
# @api private
|
2334
|
+
# @param input [Object]
|
2335
|
+
# @return [Object]
|
2336
|
+
#
|
2337
|
+
# source://dry-types//lib/dry/types/intersection.rb#22
|
2338
|
+
def call_unsafe(input); end
|
2339
|
+
|
2340
|
+
# @api private
|
2341
|
+
# @param value [Object]
|
2342
|
+
# @return [Boolean]
|
2343
|
+
#
|
2344
|
+
# source://dry-types//lib/dry/types/intersection.rb#51
|
2345
|
+
def primitive?(value); end
|
2346
|
+
|
2347
|
+
# @api public
|
2348
|
+
# @param input [Object]
|
2349
|
+
#
|
2350
|
+
# source://dry-types//lib/dry/types/intersection.rb#36
|
2351
|
+
def try(input); end
|
2352
|
+
|
2353
|
+
private
|
2354
|
+
|
2355
|
+
# @api private
|
2356
|
+
#
|
2357
|
+
# source://dry-types//lib/dry/types/intersection.rb#90
|
2358
|
+
def merge_results(left_result, right_result); end
|
2359
|
+
|
2360
|
+
# @api private
|
2361
|
+
#
|
2362
|
+
# source://dry-types//lib/dry/types/intersection.rb#72
|
2363
|
+
def try_side(side, input); end
|
2364
|
+
|
2365
|
+
# @api private
|
2366
|
+
#
|
2367
|
+
# source://dry-types//lib/dry/types/intersection.rb#58
|
2368
|
+
def try_sides(input, &block); end
|
2369
|
+
|
2370
|
+
class << self
|
2371
|
+
# source://dry-types//lib/dry/types/composition.rb#40
|
2372
|
+
def ast_type; end
|
2373
|
+
|
2374
|
+
# source://dry-types//lib/dry/types/composition.rb#41
|
2375
|
+
def composition_name; end
|
2376
|
+
|
2377
|
+
# @api public
|
2378
|
+
#
|
2379
|
+
# source://dry-types//lib/dry/types/intersection.rb#15
|
2380
|
+
def operator; end
|
2381
|
+
end
|
2382
|
+
end
|
2383
|
+
|
2384
|
+
# source://dry-types//lib/dry/types/intersection.rb#0
|
2385
|
+
class Dry::Types::Intersection::Constrained < ::Dry::Types::Intersection
|
2386
|
+
include ::Dry::Types::Composition::Constrained
|
2387
|
+
end
|
2388
|
+
|
2389
|
+
# Primitives with {Kernel} coercion methods
|
2390
|
+
#
|
2391
|
+
# @api public
|
2392
|
+
#
|
2393
|
+
# source://dry-types//lib/dry/types/core.rb#6
|
2394
|
+
Dry::Types::KERNEL_COERCIBLE = T.let(T.unsafe(nil), Hash)
|
2395
|
+
|
2396
|
+
# Lax types rescue from type-related errors when constructors fail
|
2397
|
+
#
|
2398
|
+
# @api public
|
2399
|
+
#
|
2400
|
+
# source://dry-types//lib/dry/types/lax.rb#8
|
2401
|
+
class Dry::Types::Lax
|
2402
|
+
include ::Dry::Types::Type
|
2403
|
+
include ::Dry::Types::Options
|
2404
|
+
include ::Dry::Types::Decorator
|
2405
|
+
include ::Dry::Core::Constants
|
2406
|
+
include ::Dry::Types::Builder
|
2407
|
+
include ::Dry::Types::Printable
|
2408
|
+
include ::Dry::Core::Equalizer::Methods
|
2409
|
+
|
2410
|
+
# @api public
|
2411
|
+
# @param input [Object]
|
2412
|
+
# @return [Object]
|
2413
|
+
#
|
2414
|
+
# source://dry-types//lib/dry/types/lax.rb#22
|
2415
|
+
def [](input, &_arg1); end
|
2416
|
+
|
2417
|
+
# @api public
|
2418
|
+
# @param input [Object]
|
2419
|
+
# @return [Object]
|
2420
|
+
#
|
2421
|
+
# source://dry-types//lib/dry/types/lax.rb#22
|
2422
|
+
def call(input, &_arg1); end
|
2423
|
+
|
2424
|
+
# @api public
|
2425
|
+
# @param input [Object]
|
2426
|
+
# @return [Object]
|
2427
|
+
#
|
2428
|
+
# source://dry-types//lib/dry/types/lax.rb#22
|
2429
|
+
def call_safe(input, &_arg1); end
|
2430
|
+
|
2431
|
+
# @api public
|
2432
|
+
# @param input [Object]
|
2433
|
+
# @return [Object]
|
2434
|
+
#
|
2435
|
+
# source://dry-types//lib/dry/types/lax.rb#22
|
2436
|
+
def call_unsafe(input, &_arg1); end
|
2437
|
+
|
2438
|
+
# @api public
|
2439
|
+
# @return [Lax]
|
2440
|
+
#
|
2441
|
+
# source://dry-types//lib/dry/types/lax.rb#48
|
2442
|
+
def lax; end
|
2443
|
+
|
2444
|
+
# @api public
|
2445
|
+
# @see Nominal#to_ast
|
2446
|
+
#
|
2447
|
+
# source://dry-types//lib/dry/types/lax.rb#43
|
2448
|
+
def to_ast(meta: T.unsafe(nil)); end
|
2449
|
+
|
2450
|
+
# @api public
|
2451
|
+
# @param input [Object]
|
2452
|
+
# @param block [#call, nil]
|
2453
|
+
# @return [Result, Logic::Result]
|
2454
|
+
# @yieldparam failure [Failure]
|
2455
|
+
# @yieldreturn [Result]
|
2456
|
+
#
|
2457
|
+
# source://dry-types//lib/dry/types/lax.rb#38
|
2458
|
+
def try(input, &_arg1); end
|
2459
|
+
|
2460
|
+
private
|
2461
|
+
|
2462
|
+
# @api private
|
2463
|
+
# @param response [Object, Dry::Types::Constructor]
|
2464
|
+
# @return [Boolean]
|
2465
|
+
#
|
2466
|
+
# source://dry-types//lib/dry/types/lax.rb#57
|
2467
|
+
def decorate?(response); end
|
2468
|
+
end
|
2469
|
+
|
2470
|
+
# Primitives with coercions through by convention `to_*` methods
|
2471
|
+
#
|
2472
|
+
# @api public
|
2473
|
+
#
|
2474
|
+
# source://dry-types//lib/dry/types/core.rb#16
|
2475
|
+
Dry::Types::METHOD_COERCIBLE = T.let(T.unsafe(nil), Hash)
|
2476
|
+
|
2477
|
+
# By convention methods to coerce {METHOD_COERCIBLE} primitives
|
2478
|
+
#
|
2479
|
+
# @api public
|
2480
|
+
#
|
2481
|
+
# source://dry-types//lib/dry/types/core.rb#21
|
2482
|
+
Dry::Types::METHOD_COERCIBLE_METHODS = T.let(T.unsafe(nil), Hash)
|
2483
|
+
|
2484
|
+
# Homogeneous mapping. It describes a hash with unknown keys that match a certain type.
|
2485
|
+
#
|
2486
|
+
# @api public
|
2487
|
+
# @example
|
2488
|
+
# type = Dry::Types['hash'].map(
|
2489
|
+
# Dry::Types['integer'].constrained(gteq: 1, lteq: 10),
|
2490
|
+
# Dry::Types['string']
|
2491
|
+
# )
|
2492
|
+
#
|
2493
|
+
# type.(1 => 'right')
|
2494
|
+
# # => {1 => 'right'}
|
2495
|
+
#
|
2496
|
+
# type.('1' => 'wrong')
|
2497
|
+
# # Dry::Types::MapError: "1" violates constraints (type?(Integer, "1")
|
2498
|
+
# # AND gteq?(1, "1")
|
2499
|
+
# # AND lteq?(10, "1") failed)
|
2500
|
+
#
|
2501
|
+
# type.(11 => 'wrong')
|
2502
|
+
# # Dry::Types::MapError: 11 violates constraints (lteq?(10, 11) failed)
|
2503
|
+
#
|
2504
|
+
# source://dry-types//lib/dry/types/map.rb#25
|
2505
|
+
class Dry::Types::Map < ::Dry::Types::Nominal
|
2506
|
+
# @api public
|
2507
|
+
# @return [Map] a new instance of Map
|
2508
|
+
#
|
2509
|
+
# source://dry-types//lib/dry/types/map.rb#26
|
2510
|
+
def initialize(primitive, key_type: T.unsafe(nil), value_type: T.unsafe(nil), meta: T.unsafe(nil)); end
|
2511
|
+
|
2512
|
+
# @api private
|
2513
|
+
# @param hash [Hash]
|
2514
|
+
# @return [Hash]
|
2515
|
+
#
|
2516
|
+
# source://dry-types//lib/dry/types/map.rb#61
|
2517
|
+
def call_safe(hash); end
|
2518
|
+
|
2519
|
+
# @api private
|
2520
|
+
# @param hash [Hash]
|
2521
|
+
# @return [Hash]
|
2522
|
+
#
|
2523
|
+
# source://dry-types//lib/dry/types/map.rb#50
|
2524
|
+
def call_unsafe(hash); end
|
2525
|
+
|
2526
|
+
# @api public
|
2527
|
+
# @return [Boolean]
|
2528
|
+
#
|
2529
|
+
# source://dry-types//lib/dry/types/map.rb#90
|
2530
|
+
def constrained?; end
|
2531
|
+
|
2532
|
+
# @api public
|
2533
|
+
# @return [Type]
|
2534
|
+
#
|
2535
|
+
# source://dry-types//lib/dry/types/map.rb#33
|
2536
|
+
def key_type; end
|
2537
|
+
|
2538
|
+
# @api public
|
2539
|
+
# @return [String]
|
2540
|
+
#
|
2541
|
+
# source://dry-types//lib/dry/types/map.rb#43
|
2542
|
+
def name; end
|
2543
|
+
|
2544
|
+
# @api public
|
2545
|
+
# @param meta [Boolean] Whether to dump the meta to the AST
|
2546
|
+
# @return [Array] An AST representation
|
2547
|
+
#
|
2548
|
+
# source://dry-types//lib/dry/types/map.rb#80
|
2549
|
+
def to_ast(meta: T.unsafe(nil)); end
|
2550
|
+
|
2551
|
+
# @api public
|
2552
|
+
# @param hash [Hash]
|
2553
|
+
# @return [Result]
|
2554
|
+
# @yield [result]
|
2555
|
+
#
|
2556
|
+
# source://dry-types//lib/dry/types/map.rb#68
|
2557
|
+
def try(hash); end
|
2558
|
+
|
2559
|
+
# @api public
|
2560
|
+
# @return [Type]
|
2561
|
+
#
|
2562
|
+
# source://dry-types//lib/dry/types/map.rb#38
|
2563
|
+
def value_type; end
|
2564
|
+
|
2565
|
+
private
|
2566
|
+
|
2567
|
+
# @api public
|
2568
|
+
#
|
2569
|
+
# source://dry-types//lib/dry/types/map.rb#125
|
2570
|
+
def assert_primitive(input); end
|
2571
|
+
|
2572
|
+
# @api private
|
2573
|
+
#
|
2574
|
+
# source://dry-types//lib/dry/types/map.rb#96
|
2575
|
+
def coerce(input); end
|
2576
|
+
end
|
2577
|
+
|
2578
|
+
# @api public
|
2579
|
+
#
|
2580
|
+
# source://dry-types//lib/dry/types/errors.rb#85
|
2581
|
+
class Dry::Types::MapError < ::Dry::Types::CoercionError; end
|
2582
|
+
|
2583
|
+
# Storage for meta-data
|
2584
|
+
#
|
2585
|
+
# @api public
|
2586
|
+
#
|
2587
|
+
# source://dry-types//lib/dry/types/meta.rb#8
|
2588
|
+
module Dry::Types::Meta
|
2589
|
+
# @api public
|
2590
|
+
#
|
2591
|
+
# source://dry-types//lib/dry/types/meta.rb#9
|
2592
|
+
def initialize(*args, meta: T.unsafe(nil), **options); end
|
2593
|
+
|
2594
|
+
# @api public
|
2595
|
+
# @overload meta
|
2596
|
+
# @overload meta
|
2597
|
+
#
|
2598
|
+
# source://dry-types//lib/dry/types/meta.rb#29
|
2599
|
+
def meta(data = T.unsafe(nil)); end
|
2600
|
+
|
2601
|
+
# Resets meta
|
2602
|
+
#
|
2603
|
+
# @api public
|
2604
|
+
# @return [Dry::Types::Type]
|
2605
|
+
#
|
2606
|
+
# source://dry-types//lib/dry/types/meta.rb#44
|
2607
|
+
def pristine; end
|
2608
|
+
|
2609
|
+
# @api public
|
2610
|
+
# @param options [Hash] new_options
|
2611
|
+
# @return [Type]
|
2612
|
+
#
|
2613
|
+
# source://dry-types//lib/dry/types/meta.rb#19
|
2614
|
+
def with(**options); end
|
2615
|
+
end
|
2616
|
+
|
2617
|
+
# @api public
|
2618
|
+
#
|
2619
|
+
# source://dry-types//lib/dry/types/errors.rb#90
|
2620
|
+
class Dry::Types::MissingKeyError < ::Dry::Types::SchemaKeyError
|
2621
|
+
# @api public
|
2622
|
+
# @param key [String, Symbol]
|
2623
|
+
# @return [MissingKeyError] a new instance of MissingKeyError
|
2624
|
+
#
|
2625
|
+
# source://dry-types//lib/dry/types/errors.rb#95
|
2626
|
+
def initialize(key); end
|
2627
|
+
|
2628
|
+
# @api public
|
2629
|
+
# @return [Symbol]
|
2630
|
+
#
|
2631
|
+
# source://dry-types//lib/dry/types/errors.rb#92
|
2632
|
+
def key; end
|
2633
|
+
end
|
2634
|
+
|
2635
|
+
# Export types registered in a container as module constants.
|
2636
|
+
#
|
2637
|
+
# @api public
|
2638
|
+
# @example
|
2639
|
+
# module Types
|
2640
|
+
# include Dry.Types(:strict, :coercible, :nominal, default: :strict)
|
2641
|
+
# end
|
2642
|
+
#
|
2643
|
+
# Types.constants
|
2644
|
+
# # => [:Class, :Strict, :Symbol, :Integer, :Float, :String, :Array, :Hash,
|
2645
|
+
# # :Decimal, :Nil, :True, :False, :Bool, :Date, :Nominal, :DateTime, :Range,
|
2646
|
+
# # :Coercible, :Time]
|
2647
|
+
#
|
2648
|
+
# source://dry-types//lib/dry/types/module.rb#19
|
2649
|
+
class Dry::Types::Module < ::Module
|
2650
|
+
# @api public
|
2651
|
+
# @return [Module] a new instance of Module
|
2652
|
+
#
|
2653
|
+
# source://dry-types//lib/dry/types/module.rb#20
|
2654
|
+
def initialize(registry, *args, **kwargs); end
|
2655
|
+
|
2656
|
+
# @api private
|
2657
|
+
#
|
2658
|
+
# source://dry-types//lib/dry/types/module.rb#74
|
2659
|
+
def registry_tree; end
|
2660
|
+
|
2661
|
+
# @api private
|
2662
|
+
#
|
2663
|
+
# source://dry-types//lib/dry/types/module.rb#42
|
2664
|
+
def type_constants(*namespaces, default: T.unsafe(nil), **aliases); end
|
2665
|
+
|
2666
|
+
private
|
2667
|
+
|
2668
|
+
# @api private
|
2669
|
+
#
|
2670
|
+
# source://dry-types//lib/dry/types/module.rb#89
|
2671
|
+
def check_parameters(*namespaces, default: T.unsafe(nil), **aliases); end
|
2672
|
+
|
2673
|
+
# @api private
|
2674
|
+
#
|
2675
|
+
# source://dry-types//lib/dry/types/module.rb#109
|
2676
|
+
def define_constants(constants, mod = T.unsafe(nil)); end
|
2677
|
+
end
|
2678
|
+
|
2679
|
+
# Collection of multiple errors
|
2680
|
+
#
|
2681
|
+
# @api public
|
2682
|
+
#
|
2683
|
+
# source://dry-types//lib/dry/types/errors.rb#48
|
2684
|
+
class Dry::Types::MultipleError < ::Dry::Types::CoercionError
|
2685
|
+
# @api public
|
2686
|
+
# @param errors [Array<CoercionError>]
|
2687
|
+
# @return [MultipleError] a new instance of MultipleError
|
2688
|
+
#
|
2689
|
+
# source://dry-types//lib/dry/types/errors.rb#53
|
2690
|
+
def initialize(errors); end
|
2691
|
+
|
2692
|
+
# @api public
|
2693
|
+
# @return [Array<CoercionError>]
|
2694
|
+
#
|
2695
|
+
# source://dry-types//lib/dry/types/errors.rb#50
|
2696
|
+
def errors; end
|
2697
|
+
|
2698
|
+
# @api public
|
2699
|
+
# @return string
|
2700
|
+
#
|
2701
|
+
# source://dry-types//lib/dry/types/errors.rb#59
|
2702
|
+
def message; end
|
2703
|
+
|
2704
|
+
# @api public
|
2705
|
+
# @return [Array]
|
2706
|
+
#
|
2707
|
+
# source://dry-types//lib/dry/types/errors.rb#62
|
2708
|
+
def meta; end
|
2709
|
+
end
|
2710
|
+
|
2711
|
+
# Primitives that are non-coercible
|
2712
|
+
#
|
2713
|
+
# @api public
|
2714
|
+
#
|
2715
|
+
# source://dry-types//lib/dry/types/core.rb#26
|
2716
|
+
Dry::Types::NON_COERCIBLE = T.let(T.unsafe(nil), Hash)
|
2717
|
+
|
2718
|
+
# All built-in primitives except {NilClass}
|
2719
|
+
#
|
2720
|
+
# @api public
|
2721
|
+
#
|
2722
|
+
# source://dry-types//lib/dry/types/core.rb#46
|
2723
|
+
Dry::Types::NON_NIL = T.let(T.unsafe(nil), Hash)
|
2724
|
+
|
2725
|
+
# Nominal types define a primitive class and do not apply any constructors or constraints
|
2726
|
+
#
|
2727
|
+
# Use these types for annotations and the base for building more complex types on top of them.
|
2728
|
+
#
|
2729
|
+
# @api public
|
2730
|
+
#
|
2731
|
+
# source://dry-types//lib/dry/types/nominal.rb#10
|
2732
|
+
class Dry::Types::Nominal
|
2733
|
+
include ::Dry::Types::Type
|
2734
|
+
include ::Dry::Types::Options
|
2735
|
+
include ::Dry::Types::Meta
|
2736
|
+
include ::Dry::Core::Constants
|
2737
|
+
include ::Dry::Types::Builder
|
2738
|
+
include ::Dry::Types::Printable
|
2739
|
+
include ::Dry::Core::Equalizer::Methods
|
2740
|
+
|
2741
|
+
# @api private
|
2742
|
+
# @param primitive [Type, Class]
|
2743
|
+
# @param options [Hash]
|
2744
|
+
# @return [Nominal] a new instance of Nominal
|
2745
|
+
#
|
2746
|
+
# source://dry-types//lib/dry/types/nominal.rb#42
|
2747
|
+
def initialize(primitive, **options); end
|
2748
|
+
|
2749
|
+
# @api private
|
2750
|
+
# @param input [BasicObject]
|
2751
|
+
# @return [BasicObject]
|
2752
|
+
#
|
2753
|
+
# source://dry-types//lib/dry/types/nominal.rb#80
|
2754
|
+
def call_safe(input, &_arg1); end
|
2755
|
+
|
2756
|
+
# @api private
|
2757
|
+
# @param input [BasicObject]
|
2758
|
+
# @return [BasicObject]
|
2759
|
+
#
|
2760
|
+
# source://dry-types//lib/dry/types/nominal.rb#73
|
2761
|
+
def call_unsafe(input); end
|
2762
|
+
|
2763
|
+
# @api private
|
2764
|
+
#
|
2765
|
+
# source://dry-types//lib/dry/types/nominal.rb#121
|
2766
|
+
def coerce(input, &_arg1); end
|
2767
|
+
|
2768
|
+
# @api public
|
2769
|
+
# @return [false]
|
2770
|
+
#
|
2771
|
+
# source://dry-types//lib/dry/types/nominal.rb#61
|
2772
|
+
def constrained?; end
|
2773
|
+
|
2774
|
+
# @api public
|
2775
|
+
# @return [false]
|
2776
|
+
#
|
2777
|
+
# source://dry-types//lib/dry/types/nominal.rb#56
|
2778
|
+
def default?; end
|
2779
|
+
|
2780
|
+
# @api public
|
2781
|
+
# @raise [::ArgumentError]
|
2782
|
+
# @return [Result::Failure]
|
2783
|
+
#
|
2784
|
+
# source://dry-types//lib/dry/types/nominal.rb#105
|
2785
|
+
def failure(input, error); end
|
2786
|
+
|
2787
|
+
# Return self. Nominal types are lax by definition
|
2788
|
+
#
|
2789
|
+
# @api public
|
2790
|
+
# @return [Nominal]
|
2791
|
+
#
|
2792
|
+
# source://dry-types//lib/dry/types/nominal.rb#163
|
2793
|
+
def lax; end
|
2794
|
+
|
2795
|
+
# @api public
|
2796
|
+
# @return [String]
|
2797
|
+
#
|
2798
|
+
# source://dry-types//lib/dry/types/nominal.rb#51
|
2799
|
+
def name; end
|
2800
|
+
|
2801
|
+
# @api public
|
2802
|
+
# @return [false]
|
2803
|
+
#
|
2804
|
+
# source://dry-types//lib/dry/types/nominal.rb#66
|
2805
|
+
def optional?; end
|
2806
|
+
|
2807
|
+
# @api public
|
2808
|
+
# @return [Class]
|
2809
|
+
#
|
2810
|
+
# source://dry-types//lib/dry/types/nominal.rb#19
|
2811
|
+
def primitive; end
|
2812
|
+
|
2813
|
+
# Checks whether value is of a #primitive class
|
2814
|
+
#
|
2815
|
+
# @api public
|
2816
|
+
# @param value [Object]
|
2817
|
+
# @return [Boolean]
|
2818
|
+
#
|
2819
|
+
# source://dry-types//lib/dry/types/nominal.rb#118
|
2820
|
+
def primitive?(value); end
|
2821
|
+
|
2822
|
+
# @api public
|
2823
|
+
# @return [Result::Success]
|
2824
|
+
#
|
2825
|
+
# source://dry-types//lib/dry/types/nominal.rb#98
|
2826
|
+
def success(input); end
|
2827
|
+
|
2828
|
+
# Return AST representation of a type nominal
|
2829
|
+
#
|
2830
|
+
# @api public
|
2831
|
+
# @return [Array]
|
2832
|
+
#
|
2833
|
+
# source://dry-types//lib/dry/types/nominal.rb#154
|
2834
|
+
def to_ast(meta: T.unsafe(nil)); end
|
2835
|
+
|
2836
|
+
# Wrap the type with a proc
|
2837
|
+
#
|
2838
|
+
# @api public
|
2839
|
+
# @return [Proc]
|
2840
|
+
#
|
2841
|
+
# source://dry-types//lib/dry/types/nominal.rb#170
|
2842
|
+
def to_proc; end
|
2843
|
+
|
2844
|
+
# @api public
|
2845
|
+
# @param input [Object]
|
2846
|
+
# @return [Result, Logic::Result] when a block is not provided
|
2847
|
+
# @return [nil] otherwise
|
2848
|
+
# @yieldparam failure [Failure]
|
2849
|
+
# @yieldreturn [Result]
|
2850
|
+
#
|
2851
|
+
# source://dry-types//lib/dry/types/nominal.rb#91
|
2852
|
+
def try(input, &_arg1); end
|
2853
|
+
|
2854
|
+
# @api private
|
2855
|
+
#
|
2856
|
+
# source://dry-types//lib/dry/types/nominal.rb#132
|
2857
|
+
def try_coerce(input); end
|
2858
|
+
|
2859
|
+
class << self
|
2860
|
+
# @api private
|
2861
|
+
# @param primitive [Class]
|
2862
|
+
# @return [Type]
|
2863
|
+
#
|
2864
|
+
# source://dry-types//lib/dry/types/nominal.rb#26
|
2865
|
+
def [](primitive); end
|
2866
|
+
end
|
2867
|
+
end
|
2868
|
+
|
2869
|
+
# @api public
|
2870
|
+
#
|
2871
|
+
# source://dry-types//lib/dry/types/nominal.rb#36
|
2872
|
+
Dry::Types::Nominal::ALWAYS = T.let(T.unsafe(nil), Proc)
|
2873
|
+
|
2874
|
+
# Common API for types with options
|
2875
|
+
#
|
2876
|
+
# @api private
|
2877
|
+
#
|
2878
|
+
# source://dry-types//lib/dry/types/options.rb#8
|
2879
|
+
module Dry::Types::Options
|
2880
|
+
# @api private
|
2881
|
+
# @see Nominal#initialize
|
2882
|
+
#
|
2883
|
+
# source://dry-types//lib/dry/types/options.rb#15
|
2884
|
+
def initialize(*args, **options); end
|
2885
|
+
|
2886
|
+
# @api private
|
2887
|
+
# @return [Hash]
|
2888
|
+
#
|
2889
|
+
# source://dry-types//lib/dry/types/options.rb#10
|
2890
|
+
def options; end
|
2891
|
+
|
2892
|
+
# @api private
|
2893
|
+
# @param new_options [Hash]
|
2894
|
+
# @return [Type]
|
2895
|
+
#
|
2896
|
+
# source://dry-types//lib/dry/types/options.rb#25
|
2897
|
+
def with(**new_options); end
|
2898
|
+
end
|
2899
|
+
|
2900
|
+
# source://dry-types//lib/dry/types/printer.rb#293
|
2901
|
+
Dry::Types::PRINTER = T.let(T.unsafe(nil), Dry::Types::Printer)
|
2902
|
+
|
2903
|
+
# PredicateInferrer returns the list of predicates used by a type.
|
2904
|
+
#
|
2905
|
+
# @api public
|
2906
|
+
#
|
2907
|
+
# source://dry-types//lib/dry/types/predicate_inferrer.rb#8
|
2908
|
+
class Dry::Types::PredicateInferrer
|
2909
|
+
include ::Dry::Core::Cache::Methods
|
2910
|
+
extend ::Dry::Core::Cache
|
2911
|
+
|
2912
|
+
# @api private
|
2913
|
+
# @return [PredicateInferrer] a new instance of PredicateInferrer
|
2914
|
+
#
|
2915
|
+
# source://dry-types//lib/dry/types/predicate_inferrer.rb#212
|
2916
|
+
def initialize(registry = T.unsafe(nil)); end
|
2917
|
+
|
2918
|
+
# Infer predicate identifier from the provided type
|
2919
|
+
#
|
2920
|
+
# @api private
|
2921
|
+
# @param type [Type]
|
2922
|
+
# @return [Symbol]
|
2923
|
+
#
|
2924
|
+
# source://dry-types//lib/dry/types/predicate_inferrer.rb#222
|
2925
|
+
def [](type); end
|
2926
|
+
|
2927
|
+
# @api private
|
2928
|
+
# @return [Compiler]
|
2929
|
+
#
|
2930
|
+
# source://dry-types//lib/dry/types/predicate_inferrer.rb#209
|
2931
|
+
def compiler; end
|
2932
|
+
end
|
2933
|
+
|
2934
|
+
# @api public
|
2935
|
+
#
|
2936
|
+
# source://dry-types//lib/dry/types/predicate_inferrer.rb#31
|
2937
|
+
Dry::Types::PredicateInferrer::ARRAY = T.let(T.unsafe(nil), Array)
|
2938
|
+
|
2939
|
+
# Compiler reduces type AST into a list of predicates
|
2940
|
+
#
|
2941
|
+
# @api private
|
2942
|
+
#
|
2943
|
+
# source://dry-types//lib/dry/types/predicate_inferrer.rb#38
|
2944
|
+
class Dry::Types::PredicateInferrer::Compiler
|
2945
|
+
extend ::Dry::Core::Constants
|
2946
|
+
extend ::Dry::Core::ClassAttributes
|
2947
|
+
|
2948
|
+
# @api private
|
2949
|
+
# @return [Compiler] a new instance of Compiler
|
2950
|
+
#
|
2951
|
+
# source://dry-types//lib/dry/types/predicate_inferrer.rb#49
|
2952
|
+
def initialize(registry); end
|
2953
|
+
|
2954
|
+
# @api private
|
2955
|
+
#
|
2956
|
+
# source://dry-types//lib/dry/types/predicate_inferrer.rb#54
|
2957
|
+
def infer_predicate(type); end
|
2958
|
+
|
2959
|
+
# @api private
|
2960
|
+
# @return [PredicateRegistry]
|
2961
|
+
#
|
2962
|
+
# source://dry-types//lib/dry/types/predicate_inferrer.rb#46
|
2963
|
+
def registry; end
|
2964
|
+
|
2965
|
+
# @api private
|
2966
|
+
#
|
2967
|
+
# source://dry-types//lib/dry/types/predicate_inferrer.rb#89
|
2968
|
+
def visit(node); end
|
2969
|
+
|
2970
|
+
# @api private
|
2971
|
+
#
|
2972
|
+
# source://dry-types//lib/dry/types/predicate_inferrer.rb#163
|
2973
|
+
def visit_and(node); end
|
2974
|
+
|
2975
|
+
# @api private
|
2976
|
+
#
|
2977
|
+
# source://dry-types//lib/dry/types/predicate_inferrer.rb#160
|
2978
|
+
def visit_any(_); end
|
2979
|
+
|
2980
|
+
# @api private
|
2981
|
+
#
|
2982
|
+
# source://dry-types//lib/dry/types/predicate_inferrer.rb#113
|
2983
|
+
def visit_array(_); end
|
2984
|
+
|
2985
|
+
# @api private
|
2986
|
+
#
|
2987
|
+
# source://dry-types//lib/dry/types/predicate_inferrer.rb#148
|
2988
|
+
def visit_constrained(node); end
|
2989
|
+
|
2990
|
+
# @api private
|
2991
|
+
#
|
2992
|
+
# source://dry-types//lib/dry/types/predicate_inferrer.rb#123
|
2993
|
+
def visit_constructor(node); end
|
2994
|
+
|
2995
|
+
# @api private
|
2996
|
+
#
|
2997
|
+
# source://dry-types//lib/dry/types/predicate_inferrer.rb#129
|
2998
|
+
def visit_enum(node); end
|
2999
|
+
|
3000
|
+
# @api private
|
3001
|
+
#
|
3002
|
+
# source://dry-types//lib/dry/types/predicate_inferrer.rb#107
|
3003
|
+
def visit_hash(_); end
|
3004
|
+
|
3005
|
+
# @api private
|
3006
|
+
#
|
3007
|
+
# source://dry-types//lib/dry/types/predicate_inferrer.rb#118
|
3008
|
+
def visit_lax(node); end
|
3009
|
+
|
3010
|
+
# @api private
|
3011
|
+
# @raise [::NotImplementedError]
|
3012
|
+
#
|
3013
|
+
# source://dry-types//lib/dry/types/predicate_inferrer.rb#187
|
3014
|
+
def visit_map(_node); end
|
3015
|
+
|
3016
|
+
# @api private
|
3017
|
+
#
|
3018
|
+
# source://dry-types//lib/dry/types/predicate_inferrer.rb#95
|
3019
|
+
def visit_nominal(node); end
|
3020
|
+
|
3021
|
+
# @api private
|
3022
|
+
#
|
3023
|
+
# source://dry-types//lib/dry/types/predicate_inferrer.rb#169
|
3024
|
+
def visit_predicate(node); end
|
3025
|
+
|
3026
|
+
# @api private
|
3027
|
+
#
|
3028
|
+
# source://dry-types//lib/dry/types/predicate_inferrer.rb#107
|
3029
|
+
def visit_schema(_); end
|
3030
|
+
|
3031
|
+
# @api private
|
3032
|
+
#
|
3033
|
+
# source://dry-types//lib/dry/types/predicate_inferrer.rb#135
|
3034
|
+
def visit_sum(node); end
|
3035
|
+
|
3036
|
+
private
|
3037
|
+
|
3038
|
+
# @api private
|
3039
|
+
#
|
3040
|
+
# source://dry-types//lib/dry/types/predicate_inferrer.rb#194
|
3041
|
+
def merge_predicates(nodes); end
|
3042
|
+
end
|
3043
|
+
|
3044
|
+
# @api public
|
3045
|
+
#
|
3046
|
+
# source://dry-types//lib/dry/types/predicate_inferrer.rb#29
|
3047
|
+
Dry::Types::PredicateInferrer::HASH = T.let(T.unsafe(nil), Array)
|
3048
|
+
|
3049
|
+
# @api public
|
3050
|
+
#
|
3051
|
+
# source://dry-types//lib/dry/types/predicate_inferrer.rb#33
|
3052
|
+
Dry::Types::PredicateInferrer::NIL = T.let(T.unsafe(nil), Array)
|
3053
|
+
|
3054
|
+
# @api public
|
3055
|
+
#
|
3056
|
+
# source://dry-types//lib/dry/types/predicate_inferrer.rb#25
|
3057
|
+
Dry::Types::PredicateInferrer::REDUCED_TYPES = T.let(T.unsafe(nil), Hash)
|
3058
|
+
|
3059
|
+
# @api public
|
3060
|
+
#
|
3061
|
+
# source://dry-types//lib/dry/types/predicate_inferrer.rb#11
|
3062
|
+
Dry::Types::PredicateInferrer::TYPE_TO_PREDICATE = T.let(T.unsafe(nil), Hash)
|
3063
|
+
|
3064
|
+
# A registry with predicate objects from `Dry::Logic::Predicates`
|
3065
|
+
#
|
3066
|
+
# @api private
|
3067
|
+
#
|
3068
|
+
# source://dry-types//lib/dry/types/predicate_registry.rb#8
|
3069
|
+
class Dry::Types::PredicateRegistry
|
3070
|
+
# @api private
|
3071
|
+
# @return [PredicateRegistry] a new instance of PredicateRegistry
|
3072
|
+
#
|
3073
|
+
# source://dry-types//lib/dry/types/predicate_registry.rb#19
|
3074
|
+
def initialize(predicates = T.unsafe(nil)); end
|
3075
|
+
|
3076
|
+
# @api private
|
3077
|
+
#
|
3078
|
+
# source://dry-types//lib/dry/types/predicate_registry.rb#29
|
3079
|
+
def [](name); end
|
3080
|
+
|
3081
|
+
# @api private
|
3082
|
+
#
|
3083
|
+
# source://dry-types//lib/dry/types/predicate_registry.rb#13
|
3084
|
+
def has_predicate; end
|
3085
|
+
|
3086
|
+
# @api private
|
3087
|
+
# @return [Boolean]
|
3088
|
+
#
|
3089
|
+
# source://dry-types//lib/dry/types/predicate_registry.rb#24
|
3090
|
+
def key?(name); end
|
3091
|
+
|
3092
|
+
# @api private
|
3093
|
+
#
|
3094
|
+
# source://dry-types//lib/dry/types/predicate_registry.rb#10
|
3095
|
+
def predicates; end
|
3096
|
+
end
|
3097
|
+
|
3098
|
+
# @api private
|
3099
|
+
#
|
3100
|
+
# source://dry-types//lib/dry/types/predicate_registry.rb#15
|
3101
|
+
Dry::Types::PredicateRegistry::KERNEL_RESPOND_TO = T.let(T.unsafe(nil), UnboundMethod)
|
3102
|
+
|
3103
|
+
# PrimitiveInferrer returns the list of classes matching a type.
|
3104
|
+
#
|
3105
|
+
# @api public
|
3106
|
+
#
|
3107
|
+
# source://dry-types//lib/dry/types/primitive_inferrer.rb#8
|
3108
|
+
class Dry::Types::PrimitiveInferrer
|
3109
|
+
include ::Dry::Core::Cache::Methods
|
3110
|
+
extend ::Dry::Core::Cache
|
3111
|
+
|
3112
|
+
# @api private
|
3113
|
+
# @return [PrimitiveInferrer] a new instance of PrimitiveInferrer
|
3114
|
+
#
|
3115
|
+
# source://dry-types//lib/dry/types/primitive_inferrer.rb#71
|
3116
|
+
def initialize; end
|
3117
|
+
|
3118
|
+
# Infer primitives from the provided type
|
3119
|
+
#
|
3120
|
+
# @api private
|
3121
|
+
# @return [Array[Class]]
|
3122
|
+
#
|
3123
|
+
# source://dry-types//lib/dry/types/primitive_inferrer.rb#80
|
3124
|
+
def [](type); end
|
3125
|
+
|
3126
|
+
# @api private
|
3127
|
+
# @return [Compiler]
|
3128
|
+
#
|
3129
|
+
# source://dry-types//lib/dry/types/primitive_inferrer.rb#68
|
3130
|
+
def compiler; end
|
3131
|
+
end
|
3132
|
+
|
3133
|
+
# Compiler reduces type AST into a list of primitives
|
3134
|
+
#
|
3135
|
+
# @api private
|
3136
|
+
#
|
3137
|
+
# source://dry-types//lib/dry/types/primitive_inferrer.rb#14
|
3138
|
+
class Dry::Types::PrimitiveInferrer::Compiler
|
3139
|
+
# @api private
|
3140
|
+
#
|
3141
|
+
# source://dry-types//lib/dry/types/primitive_inferrer.rb#16
|
3142
|
+
def visit(node); end
|
3143
|
+
|
3144
|
+
# @api private
|
3145
|
+
#
|
3146
|
+
# source://dry-types//lib/dry/types/primitive_inferrer.rb#63
|
3147
|
+
def visit_any(_); end
|
3148
|
+
|
3149
|
+
# @api private
|
3150
|
+
#
|
3151
|
+
# source://dry-types//lib/dry/types/primitive_inferrer.rb#32
|
3152
|
+
def visit_array(_); end
|
3153
|
+
|
3154
|
+
# @api private
|
3155
|
+
#
|
3156
|
+
# source://dry-types//lib/dry/types/primitive_inferrer.rb#57
|
3157
|
+
def visit_constrained(node); end
|
3158
|
+
|
3159
|
+
# @api private
|
3160
|
+
#
|
3161
|
+
# source://dry-types//lib/dry/types/primitive_inferrer.rb#38
|
3162
|
+
def visit_constructor(node); end
|
3163
|
+
|
3164
|
+
# @api private
|
3165
|
+
#
|
3166
|
+
# source://dry-types//lib/dry/types/primitive_inferrer.rb#44
|
3167
|
+
def visit_enum(node); end
|
3168
|
+
|
3169
|
+
# @api private
|
3170
|
+
#
|
3171
|
+
# source://dry-types//lib/dry/types/primitive_inferrer.rb#28
|
3172
|
+
def visit_hash(_); end
|
3173
|
+
|
3174
|
+
# @api private
|
3175
|
+
#
|
3176
|
+
# source://dry-types//lib/dry/types/primitive_inferrer.rb#35
|
3177
|
+
def visit_lax(node); end
|
3178
|
+
|
3179
|
+
# @api private
|
3180
|
+
#
|
3181
|
+
# source://dry-types//lib/dry/types/primitive_inferrer.rb#22
|
3182
|
+
def visit_nominal(node); end
|
3183
|
+
|
3184
|
+
# @api private
|
3185
|
+
#
|
3186
|
+
# source://dry-types//lib/dry/types/primitive_inferrer.rb#28
|
3187
|
+
def visit_schema(_); end
|
3188
|
+
|
3189
|
+
# @api private
|
3190
|
+
#
|
3191
|
+
# source://dry-types//lib/dry/types/primitive_inferrer.rb#50
|
3192
|
+
def visit_sum(node); end
|
3193
|
+
end
|
3194
|
+
|
3195
|
+
# @api private
|
3196
|
+
#
|
3197
|
+
# source://dry-types//lib/dry/types/printable.rb#6
|
3198
|
+
module Dry::Types::Printable
|
3199
|
+
# @api private
|
3200
|
+
# @return [String]
|
3201
|
+
#
|
3202
|
+
# source://dry-types//lib/dry/types/printable.rb#10
|
3203
|
+
def inspect; end
|
3204
|
+
|
3205
|
+
# @api private
|
3206
|
+
# @return [String]
|
3207
|
+
#
|
3208
|
+
# source://dry-types//lib/dry/types/printable.rb#10
|
3209
|
+
def to_s; end
|
3210
|
+
end
|
3211
|
+
|
3212
|
+
# @api private
|
3213
|
+
#
|
3214
|
+
# source://dry-types//lib/dry/types/printer/composition.rb#6
|
3215
|
+
class Dry::Types::Printer
|
3216
|
+
# @api private
|
3217
|
+
# @return [Printer] a new instance of Printer
|
3218
|
+
#
|
3219
|
+
# source://dry-types//lib/dry/types/printer.rb#38
|
3220
|
+
def initialize; end
|
3221
|
+
|
3222
|
+
# @api private
|
3223
|
+
#
|
3224
|
+
# source://dry-types//lib/dry/types/printer.rb#43
|
3225
|
+
def call(type); end
|
3226
|
+
|
3227
|
+
# @api private
|
3228
|
+
#
|
3229
|
+
# source://dry-types//lib/dry/types/printer.rb#49
|
3230
|
+
def visit(type, &_arg1); end
|
3231
|
+
|
3232
|
+
# @api private
|
3233
|
+
# @yield ["Any"]
|
3234
|
+
#
|
3235
|
+
# source://dry-types//lib/dry/types/printer.rb#62
|
3236
|
+
def visit_any(_); end
|
3237
|
+
|
3238
|
+
# @api private
|
3239
|
+
#
|
3240
|
+
# source://dry-types//lib/dry/types/printer.rb#64
|
3241
|
+
def visit_array(type); end
|
3242
|
+
|
3243
|
+
# @api private
|
3244
|
+
#
|
3245
|
+
# source://dry-types//lib/dry/types/printer.rb#70
|
3246
|
+
def visit_array_member(array); end
|
3247
|
+
|
3248
|
+
# @api private
|
3249
|
+
#
|
3250
|
+
# source://dry-types//lib/dry/types/printer.rb#152
|
3251
|
+
def visit_callable(callable); end
|
3252
|
+
|
3253
|
+
# @api private
|
3254
|
+
#
|
3255
|
+
# source://dry-types//lib/dry/types/printer.rb#102
|
3256
|
+
def visit_composition(composition, &_arg1); end
|
3257
|
+
|
3258
|
+
# @api private
|
3259
|
+
#
|
3260
|
+
# source://dry-types//lib/dry/types/printer.rb#91
|
3261
|
+
def visit_constrained(constrained); end
|
3262
|
+
|
3263
|
+
# @api private
|
3264
|
+
#
|
3265
|
+
# source://dry-types//lib/dry/types/printer.rb#78
|
3266
|
+
def visit_constructor(constructor); end
|
3267
|
+
|
3268
|
+
# @api private
|
3269
|
+
#
|
3270
|
+
# source://dry-types//lib/dry/types/printer.rb#126
|
3271
|
+
def visit_default(default); end
|
3272
|
+
|
3273
|
+
# @api private
|
3274
|
+
#
|
3275
|
+
# source://dry-types//lib/dry/types/printer.rb#108
|
3276
|
+
def visit_enum(enum); end
|
3277
|
+
|
3278
|
+
# @api private
|
3279
|
+
#
|
3280
|
+
# source://dry-types//lib/dry/types/printer.rb#250
|
3281
|
+
def visit_hash(hash); end
|
3282
|
+
|
3283
|
+
# @api private
|
3284
|
+
#
|
3285
|
+
# source://dry-types//lib/dry/types/printer.rb#240
|
3286
|
+
def visit_key(key); end
|
3287
|
+
|
3288
|
+
# @api private
|
3289
|
+
#
|
3290
|
+
# source://dry-types//lib/dry/types/printer.rb#146
|
3291
|
+
def visit_lax(lax); end
|
3292
|
+
|
3293
|
+
# @api private
|
3294
|
+
#
|
3295
|
+
# source://dry-types//lib/dry/types/printer.rb#226
|
3296
|
+
def visit_map(map); end
|
3297
|
+
|
3298
|
+
# @api private
|
3299
|
+
#
|
3300
|
+
# source://dry-types//lib/dry/types/printer.rb#140
|
3301
|
+
def visit_nominal(type); end
|
3302
|
+
|
3303
|
+
# @api private
|
3304
|
+
#
|
3305
|
+
# source://dry-types//lib/dry/types/printer.rb#269
|
3306
|
+
def visit_options(options, meta = T.unsafe(nil)); end
|
3307
|
+
|
3308
|
+
# @api private
|
3309
|
+
#
|
3310
|
+
# source://dry-types//lib/dry/types/printer.rb#187
|
3311
|
+
def visit_schema(schema); end
|
3312
|
+
end
|
3313
|
+
|
3314
|
+
# @api private
|
3315
|
+
#
|
3316
|
+
# source://dry-types//lib/dry/types/printer/composition.rb#8
|
3317
|
+
class Dry::Types::Printer::Composition
|
3318
|
+
# @api private
|
3319
|
+
# @return [Composition] a new instance of Composition
|
3320
|
+
#
|
3321
|
+
# source://dry-types//lib/dry/types/printer/composition.rb#9
|
3322
|
+
def initialize(printer, composition_class); end
|
3323
|
+
|
3324
|
+
# @api private
|
3325
|
+
#
|
3326
|
+
# source://dry-types//lib/dry/types/printer/composition.rb#15
|
3327
|
+
def visit(composition); end
|
3328
|
+
|
3329
|
+
private
|
3330
|
+
|
3331
|
+
# @api private
|
3332
|
+
#
|
3333
|
+
# source://dry-types//lib/dry/types/printer/composition.rb#33
|
3334
|
+
def visit_constructor(type, &_arg1); end
|
3335
|
+
|
3336
|
+
# @api private
|
3337
|
+
#
|
3338
|
+
# source://dry-types//lib/dry/types/printer/composition.rb#25
|
3339
|
+
def visit_constructors(composition); end
|
3340
|
+
end
|
3341
|
+
|
3342
|
+
# @api private
|
3343
|
+
#
|
3344
|
+
# source://dry-types//lib/dry/types/printer.rb#11
|
3345
|
+
Dry::Types::Printer::MAPPING = T.let(T.unsafe(nil), Hash)
|
3346
|
+
|
3347
|
+
# Result class used by {Type#try}
|
3348
|
+
#
|
3349
|
+
# @api public
|
3350
|
+
#
|
3351
|
+
# source://dry-types//lib/dry/types/result.rb#8
|
3352
|
+
class Dry::Types::Result
|
3353
|
+
include ::Dry::Core::Equalizer::Methods
|
3354
|
+
|
3355
|
+
# @api private
|
3356
|
+
# @param input [Object]
|
3357
|
+
# @return [Result] a new instance of Result
|
3358
|
+
#
|
3359
|
+
# source://dry-types//lib/dry/types/result.rb#17
|
3360
|
+
def initialize(input); end
|
3361
|
+
|
3362
|
+
# @api public
|
3363
|
+
# @return [Object]
|
3364
|
+
#
|
3365
|
+
# source://dry-types//lib/dry/types/result.rb#12
|
3366
|
+
def input; end
|
3367
|
+
end
|
3368
|
+
|
3369
|
+
# Failure result
|
3370
|
+
#
|
3371
|
+
# @api public
|
3372
|
+
#
|
3373
|
+
# source://dry-types//lib/dry/types/result.rb#39
|
3374
|
+
class Dry::Types::Result::Failure < ::Dry::Types::Result
|
3375
|
+
# @api private
|
3376
|
+
# @param input [Object]
|
3377
|
+
# @param error [#to_s]
|
3378
|
+
# @return [Failure] a new instance of Failure
|
3379
|
+
#
|
3380
|
+
# source://dry-types//lib/dry/types/result.rb#50
|
3381
|
+
def initialize(input, error); end
|
3382
|
+
|
3383
|
+
# @api public
|
3384
|
+
# @return [#to_s]
|
3385
|
+
#
|
3386
|
+
# source://dry-types//lib/dry/types/result.rb#43
|
3387
|
+
def error; end
|
3388
|
+
|
3389
|
+
# @api public
|
3390
|
+
# @return [true]
|
3391
|
+
#
|
3392
|
+
# source://dry-types//lib/dry/types/result.rb#68
|
3393
|
+
def failure?; end
|
3394
|
+
|
3395
|
+
# @api public
|
3396
|
+
# @return [false]
|
3397
|
+
#
|
3398
|
+
# source://dry-types//lib/dry/types/result.rb#63
|
3399
|
+
def success?; end
|
3400
|
+
|
3401
|
+
# @api private
|
3402
|
+
# @return [String]
|
3403
|
+
#
|
3404
|
+
# source://dry-types//lib/dry/types/result.rb#58
|
3405
|
+
def to_s; end
|
3406
|
+
end
|
3407
|
+
|
3408
|
+
# Success result
|
3409
|
+
#
|
3410
|
+
# @api public
|
3411
|
+
#
|
3412
|
+
# source://dry-types//lib/dry/types/result.rb#24
|
3413
|
+
class Dry::Types::Result::Success < ::Dry::Types::Result
|
3414
|
+
# @api public
|
3415
|
+
# @return [false]
|
3416
|
+
#
|
3417
|
+
# source://dry-types//lib/dry/types/result.rb#33
|
3418
|
+
def failure?; end
|
3419
|
+
|
3420
|
+
# @api public
|
3421
|
+
# @return [true]
|
3422
|
+
#
|
3423
|
+
# source://dry-types//lib/dry/types/result.rb#28
|
3424
|
+
def success?; end
|
3425
|
+
end
|
3426
|
+
|
3427
|
+
# @api public
|
3428
|
+
Dry::Types::Safe = Dry::Types::Lax
|
3429
|
+
|
3430
|
+
# The built-in Hash type can be defined in terms of keys and associated types
|
3431
|
+
# its values can contain. Such definitions are named {Schema}s and defined
|
3432
|
+
# as lists of {Key} types.
|
3433
|
+
#
|
3434
|
+
# {Schema} evaluates default values for keys missing in input hash
|
3435
|
+
#
|
3436
|
+
# {Schema} implements Enumerable using its keys as collection.
|
3437
|
+
#
|
3438
|
+
# @api public
|
3439
|
+
# @see Dry::Types::Schema::Key
|
3440
|
+
# @see Dry::Types::Default#evaluate
|
3441
|
+
# @see Dry::Types::Default::Callable#evaluate
|
3442
|
+
#
|
3443
|
+
# source://dry-types//lib/dry/types/schema.rb#19
|
3444
|
+
class Dry::Types::Schema < ::Dry::Types::Hash
|
3445
|
+
include ::Enumerable
|
3446
|
+
|
3447
|
+
# @api private
|
3448
|
+
# @option options
|
3449
|
+
# @option options
|
3450
|
+
# @param _primitive [Class]
|
3451
|
+
# @param options [Hash]
|
3452
|
+
# @return [Schema] a new instance of Schema
|
3453
|
+
#
|
3454
|
+
# source://dry-types//lib/dry/types/schema.rb#41
|
3455
|
+
def initialize(_primitive, **options); end
|
3456
|
+
|
3457
|
+
# @api public
|
3458
|
+
# @option options
|
3459
|
+
# @option options
|
3460
|
+
# @param hash [Hash]
|
3461
|
+
# @param options [Hash] a customizable set of options
|
3462
|
+
# @return [Hash{Symbol => Object}]
|
3463
|
+
#
|
3464
|
+
# source://dry-types//lib/dry/types/schema.rb#80
|
3465
|
+
def apply(hash, options = T.unsafe(nil)); end
|
3466
|
+
|
3467
|
+
# @api private
|
3468
|
+
# @param hash [Hash]
|
3469
|
+
# @return [Hash{Symbol => Object}]
|
3470
|
+
#
|
3471
|
+
# source://dry-types//lib/dry/types/schema.rb#68
|
3472
|
+
def call_safe(hash, options = T.unsafe(nil)); end
|
3473
|
+
|
3474
|
+
# @api private
|
3475
|
+
# @param hash [Hash]
|
3476
|
+
# @return [Hash{Symbol => Object}]
|
3477
|
+
#
|
3478
|
+
# source://dry-types//lib/dry/types/schema.rb#59
|
3479
|
+
def call_unsafe(hash, options = T.unsafe(nil)); end
|
3480
|
+
|
3481
|
+
# Empty schema with the same options
|
3482
|
+
#
|
3483
|
+
# @api public
|
3484
|
+
# @return [Schema]
|
3485
|
+
#
|
3486
|
+
# source://dry-types//lib/dry/types/schema.rb#296
|
3487
|
+
def clear; end
|
3488
|
+
|
3489
|
+
# @api public
|
3490
|
+
# @return [Boolean]
|
3491
|
+
#
|
3492
|
+
# source://dry-types//lib/dry/types/schema.rb#268
|
3493
|
+
def constrained?; end
|
3494
|
+
|
3495
|
+
# Iterate over each key type
|
3496
|
+
#
|
3497
|
+
# @api public
|
3498
|
+
# @return [Array<Dry::Types::Schema::Key>, Enumerator]
|
3499
|
+
#
|
3500
|
+
# source://dry-types//lib/dry/types/schema.rb#227
|
3501
|
+
def each(&_arg0); end
|
3502
|
+
|
3503
|
+
# Fetch key type by a key name
|
3504
|
+
#
|
3505
|
+
# Behaves as ::Hash#fetch
|
3506
|
+
#
|
3507
|
+
# @api public
|
3508
|
+
# @overload key
|
3509
|
+
# @overload key
|
3510
|
+
#
|
3511
|
+
# source://dry-types//lib/dry/types/schema.rb#257
|
3512
|
+
def key(name, fallback = T.unsafe(nil), &_arg2); end
|
3513
|
+
|
3514
|
+
# Whether the schema has the given key
|
3515
|
+
#
|
3516
|
+
# @api public
|
3517
|
+
# @param name [Symbol] Key name
|
3518
|
+
# @return [Boolean]
|
3519
|
+
#
|
3520
|
+
# source://dry-types//lib/dry/types/schema.rb#238
|
3521
|
+
def key?(name); end
|
3522
|
+
|
3523
|
+
# @api public
|
3524
|
+
# @return [Array[Dry::Types::Schema::Key]]
|
3525
|
+
#
|
3526
|
+
# source://dry-types//lib/dry/types/schema.rb#26
|
3527
|
+
def keys; end
|
3528
|
+
|
3529
|
+
# @api public
|
3530
|
+
# @return [Lax]
|
3531
|
+
#
|
3532
|
+
# source://dry-types//lib/dry/types/schema.rb#275
|
3533
|
+
def lax; end
|
3534
|
+
|
3535
|
+
# Merge given schema keys into current schema
|
3536
|
+
#
|
3537
|
+
# A new instance is returned.
|
3538
|
+
#
|
3539
|
+
# @api public
|
3540
|
+
# @param other [Schema] schema
|
3541
|
+
# @return [Schema]
|
3542
|
+
#
|
3543
|
+
# source://dry-types//lib/dry/types/schema.rb#287
|
3544
|
+
def merge(other); end
|
3545
|
+
|
3546
|
+
# @api public
|
3547
|
+
# @return [Hash[Symbol, Dry::Types::Schema::Key]]
|
3548
|
+
#
|
3549
|
+
# source://dry-types//lib/dry/types/schema.rb#29
|
3550
|
+
def name_key_map; end
|
3551
|
+
|
3552
|
+
# @api public
|
3553
|
+
# @overload schema
|
3554
|
+
# @overload schema
|
3555
|
+
#
|
3556
|
+
# source://dry-types//lib/dry/types/schema.rb#211
|
3557
|
+
def schema(keys_or_map); end
|
3558
|
+
|
3559
|
+
# Make the schema intolerant to unknown keys
|
3560
|
+
#
|
3561
|
+
# @api public
|
3562
|
+
# @return [Schema]
|
3563
|
+
#
|
3564
|
+
# source://dry-types//lib/dry/types/schema.rb#170
|
3565
|
+
def strict(strict = T.unsafe(nil)); end
|
3566
|
+
|
3567
|
+
# Whether the schema rejects unknown keys
|
3568
|
+
#
|
3569
|
+
# @api public
|
3570
|
+
# @return [Boolean]
|
3571
|
+
#
|
3572
|
+
# source://dry-types//lib/dry/types/schema.rb#161
|
3573
|
+
def strict?; end
|
3574
|
+
|
3575
|
+
# @api public
|
3576
|
+
# @param meta [Boolean] Whether to dump the meta to the AST
|
3577
|
+
# @return [Array] An AST representation
|
3578
|
+
#
|
3579
|
+
# source://dry-types//lib/dry/types/schema.rb#147
|
3580
|
+
def to_ast(meta: T.unsafe(nil)); end
|
3581
|
+
|
3582
|
+
# @api public
|
3583
|
+
# @return [#call]
|
3584
|
+
#
|
3585
|
+
# source://dry-types//lib/dry/types/schema.rb#32
|
3586
|
+
def transform_key; end
|
3587
|
+
|
3588
|
+
# Whether the schema transforms input keys
|
3589
|
+
#
|
3590
|
+
# @api public
|
3591
|
+
# @return [Boolean]
|
3592
|
+
#
|
3593
|
+
# source://dry-types//lib/dry/types/schema.rb#196
|
3594
|
+
def transform_keys?; end
|
3595
|
+
|
3596
|
+
# @api public
|
3597
|
+
# @param input [Hash] hash
|
3598
|
+
# @return [Logic::Result]
|
3599
|
+
# @return [Object] if coercion fails and a block is given
|
3600
|
+
# @yieldparam failure [Failure]
|
3601
|
+
# @yieldreturn [Result]
|
3602
|
+
#
|
3603
|
+
# source://dry-types//lib/dry/types/schema.rb#93
|
3604
|
+
def try(input); end
|
3605
|
+
|
3606
|
+
# Inject a key transformation function
|
3607
|
+
#
|
3608
|
+
# @api public
|
3609
|
+
# @param proc [#call, nil]
|
3610
|
+
# @param block [#call, nil]
|
3611
|
+
# @raise [::ArgumentError]
|
3612
|
+
# @return [Schema]
|
3613
|
+
#
|
3614
|
+
# source://dry-types//lib/dry/types/schema.rb#182
|
3615
|
+
def with_key_transform(proc = T.unsafe(nil), &block); end
|
3616
|
+
|
3617
|
+
private
|
3618
|
+
|
3619
|
+
# @api private
|
3620
|
+
# @param keys [Array<Dry::Types::Schema::Keys>]
|
3621
|
+
# @return [Dry::Types::Schema]
|
3622
|
+
#
|
3623
|
+
# source://dry-types//lib/dry/types/schema.rb#307
|
3624
|
+
def merge_keys(*keys); end
|
3625
|
+
|
3626
|
+
# @api private
|
3627
|
+
# @return [MissingKeyError]
|
3628
|
+
#
|
3629
|
+
# source://dry-types//lib/dry/types/schema.rb#403
|
3630
|
+
def missing_key(key); end
|
3631
|
+
|
3632
|
+
# Try to add missing keys to the hash
|
3633
|
+
#
|
3634
|
+
# @api private
|
3635
|
+
#
|
3636
|
+
# source://dry-types//lib/dry/types/schema.rb#371
|
3637
|
+
def resolve_missing_keys(hash, options); end
|
3638
|
+
|
3639
|
+
# Validate and coerce a hash. Call a block and halt on any error
|
3640
|
+
#
|
3641
|
+
# @api private
|
3642
|
+
# @return [Hash]
|
3643
|
+
#
|
3644
|
+
# source://dry-types//lib/dry/types/schema.rb#349
|
3645
|
+
def resolve_safe(hash, options = T.unsafe(nil), &block); end
|
3646
|
+
|
3647
|
+
# Validate and coerce a hash. Raise an exception on any error
|
3648
|
+
#
|
3649
|
+
# @api private
|
3650
|
+
# @return [Hash]
|
3651
|
+
#
|
3652
|
+
# source://dry-types//lib/dry/types/schema.rb#319
|
3653
|
+
def resolve_unsafe(hash, options = T.unsafe(nil)); end
|
3654
|
+
|
3655
|
+
# @api private
|
3656
|
+
# @param hash_keys [Array<Symbol>]
|
3657
|
+
# @return [UnknownKeysError]
|
3658
|
+
#
|
3659
|
+
# source://dry-types//lib/dry/types/schema.rb#395
|
3660
|
+
def unexpected_keys(hash_keys); end
|
3661
|
+
end
|
3662
|
+
|
3663
|
+
# Proxy type for schema keys. Contains only key name and
|
3664
|
+
# whether it's required or not. All other calls deletaged
|
3665
|
+
# to the wrapped type.
|
3666
|
+
#
|
3667
|
+
# @api public
|
3668
|
+
# @see Dry::Types::Schema
|
3669
|
+
#
|
3670
|
+
# source://dry-types//lib/dry/types/schema/key.rb#14
|
3671
|
+
class Dry::Types::Schema::Key
|
3672
|
+
include ::Dry::Types::Type
|
3673
|
+
include ::Dry::Core::Equalizer::Methods
|
3674
|
+
include ::Dry::Types::Options
|
3675
|
+
include ::Dry::Types::Decorator
|
3676
|
+
include ::Dry::Core::Constants
|
3677
|
+
include ::Dry::Types::Builder
|
3678
|
+
include ::Dry::Types::Printable
|
3679
|
+
extend ::Dry::Core::Deprecations::Interface
|
3680
|
+
|
3681
|
+
# @api private
|
3682
|
+
# @return [Key] a new instance of Key
|
3683
|
+
#
|
3684
|
+
# source://dry-types//lib/dry/types/schema/key.rb#26
|
3685
|
+
def initialize(type, name, required: T.unsafe(nil), **options); end
|
3686
|
+
|
3687
|
+
# @api private
|
3688
|
+
#
|
3689
|
+
# source://dry-types//lib/dry/types/schema/key.rb#41
|
3690
|
+
def call_safe(input, &_arg1); end
|
3691
|
+
|
3692
|
+
# @api private
|
3693
|
+
#
|
3694
|
+
# source://dry-types//lib/dry/types/schema/key.rb#44
|
3695
|
+
def call_unsafe(input); end
|
3696
|
+
|
3697
|
+
# Turn key into a lax type. Lax types are not strict hence such keys are not required
|
3698
|
+
#
|
3699
|
+
# @api public
|
3700
|
+
# @return [Lax]
|
3701
|
+
#
|
3702
|
+
# source://dry-types//lib/dry/types/schema/key.rb#90
|
3703
|
+
def lax; end
|
3704
|
+
|
3705
|
+
# @api public
|
3706
|
+
# @see Dry::Types::Meta#meta
|
3707
|
+
#
|
3708
|
+
# source://dry-types//lib/dry/types/schema/key.rb#118
|
3709
|
+
def meta(data = T.unsafe(nil)); end
|
3710
|
+
|
3711
|
+
# @api public
|
3712
|
+
# @return [Symbol]
|
3713
|
+
#
|
3714
|
+
# source://dry-types//lib/dry/types/schema/key.rb#23
|
3715
|
+
def name; end
|
3716
|
+
|
3717
|
+
# Make key not required
|
3718
|
+
#
|
3719
|
+
# @api public
|
3720
|
+
# @return [Dry::Types::Schema::Key]
|
3721
|
+
#
|
3722
|
+
# source://dry-types//lib/dry/types/schema/key.rb#83
|
3723
|
+
def omittable; end
|
3724
|
+
|
3725
|
+
# Make wrapped type optional
|
3726
|
+
#
|
3727
|
+
# @api public
|
3728
|
+
# @return [Key]
|
3729
|
+
#
|
3730
|
+
# source://dry-types//lib/dry/types/schema/key.rb#97
|
3731
|
+
def optional; end
|
3732
|
+
|
3733
|
+
# Control whether the key is required
|
3734
|
+
#
|
3735
|
+
# @api public
|
3736
|
+
# @overload required
|
3737
|
+
# @overload required
|
3738
|
+
#
|
3739
|
+
# source://dry-types//lib/dry/types/schema/key.rb#70
|
3740
|
+
def required(required = T.unsafe(nil)); end
|
3741
|
+
|
3742
|
+
# Whether the key is required in schema input
|
3743
|
+
#
|
3744
|
+
# @api public
|
3745
|
+
# @return [Boolean]
|
3746
|
+
#
|
3747
|
+
# source://dry-types//lib/dry/types/schema/key.rb#56
|
3748
|
+
def required?; end
|
3749
|
+
|
3750
|
+
# Dump to internal AST representation
|
3751
|
+
#
|
3752
|
+
# @api public
|
3753
|
+
# @return [Array]
|
3754
|
+
#
|
3755
|
+
# source://dry-types//lib/dry/types/schema/key.rb#104
|
3756
|
+
def to_ast(meta: T.unsafe(nil)); end
|
3757
|
+
|
3758
|
+
# @api public
|
3759
|
+
# @see Dry::Types::Nominal#try
|
3760
|
+
#
|
3761
|
+
# source://dry-types//lib/dry/types/schema/key.rb#49
|
3762
|
+
def try(input, &_arg1); end
|
3763
|
+
|
3764
|
+
private
|
3765
|
+
|
3766
|
+
# @api private
|
3767
|
+
# @return [Boolean]
|
3768
|
+
#
|
3769
|
+
# source://dry-types//lib/dry/types/schema/key.rb#134
|
3770
|
+
def decorate?(response); end
|
3771
|
+
end
|
3772
|
+
|
3773
|
+
# @api public
|
3774
|
+
#
|
3775
|
+
# source://dry-types//lib/dry/types/schema.rb#20
|
3776
|
+
Dry::Types::Schema::NO_TRANSFORM = T.let(T.unsafe(nil), String)
|
3777
|
+
|
3778
|
+
# @api public
|
3779
|
+
#
|
3780
|
+
# source://dry-types//lib/dry/types/schema.rb#21
|
3781
|
+
Dry::Types::Schema::SYMBOLIZE_KEY = T.let(T.unsafe(nil), String)
|
3782
|
+
|
3783
|
+
# @api public
|
3784
|
+
#
|
3785
|
+
# source://dry-types//lib/dry/types/errors.rb#65
|
3786
|
+
class Dry::Types::SchemaError < ::Dry::Types::CoercionError
|
3787
|
+
# @api public
|
3788
|
+
# @param key [String, Symbol]
|
3789
|
+
# @param value [Object]
|
3790
|
+
# @param result [String, #to_s]
|
3791
|
+
# @return [SchemaError] a new instance of SchemaError
|
3792
|
+
#
|
3793
|
+
# source://dry-types//lib/dry/types/errors.rb#75
|
3794
|
+
def initialize(key, value, result); end
|
3795
|
+
|
3796
|
+
# @api public
|
3797
|
+
# @return [String, Symbol]
|
3798
|
+
#
|
3799
|
+
# source://dry-types//lib/dry/types/errors.rb#67
|
3800
|
+
def key; end
|
3801
|
+
|
3802
|
+
# @api public
|
3803
|
+
# @return [Object]
|
3804
|
+
#
|
3805
|
+
# source://dry-types//lib/dry/types/errors.rb#70
|
3806
|
+
def value; end
|
3807
|
+
end
|
3808
|
+
|
3809
|
+
# @api public
|
3810
|
+
#
|
3811
|
+
# source://dry-types//lib/dry/types/errors.rb#87
|
3812
|
+
class Dry::Types::SchemaKeyError < ::Dry::Types::CoercionError; end
|
3813
|
+
|
3814
|
+
# Sum type
|
3815
|
+
#
|
3816
|
+
# @api public
|
3817
|
+
#
|
3818
|
+
# source://dry-types//lib/dry/types/sum.rb#8
|
3819
|
+
class Dry::Types::Sum
|
3820
|
+
include ::Dry::Types::Type
|
3821
|
+
include ::Dry::Core::Constants
|
3822
|
+
include ::Dry::Types::Builder
|
3823
|
+
include ::Dry::Types::Options
|
3824
|
+
include ::Dry::Types::Meta
|
3825
|
+
include ::Dry::Types::Printable
|
3826
|
+
include ::Dry::Core::Equalizer::Methods
|
3827
|
+
include ::Dry::Types::Composition
|
3828
|
+
|
3829
|
+
# @api private
|
3830
|
+
# @param input [Object]
|
3831
|
+
# @return [Object]
|
3832
|
+
#
|
3833
|
+
# source://dry-types//lib/dry/types/sum.rb#32
|
3834
|
+
def call_safe(input, &block); end
|
3835
|
+
|
3836
|
+
# @api private
|
3837
|
+
# @param input [Object]
|
3838
|
+
# @return [Object]
|
3839
|
+
#
|
3840
|
+
# source://dry-types//lib/dry/types/sum.rb#23
|
3841
|
+
def call_unsafe(input); end
|
3842
|
+
|
3843
|
+
# @api public
|
3844
|
+
# @param options [Hash]
|
3845
|
+
# @return [Constrained, Sum]
|
3846
|
+
# @see Builder#constrained
|
3847
|
+
#
|
3848
|
+
# source://dry-types//lib/dry/types/sum.rb#83
|
3849
|
+
def constrained(*_arg0, **_arg1, &_arg2); end
|
3850
|
+
|
3851
|
+
# Manage metadata to the type. If the type is an optional, #meta delegates
|
3852
|
+
# to the right branch
|
3853
|
+
#
|
3854
|
+
# @api public
|
3855
|
+
# @see [Meta#meta]
|
3856
|
+
#
|
3857
|
+
# source://dry-types//lib/dry/types/sum.rb#66
|
3858
|
+
def meta(data = T.unsafe(nil)); end
|
3859
|
+
|
3860
|
+
# @api public
|
3861
|
+
# @return [Boolean]
|
3862
|
+
#
|
3863
|
+
# source://dry-types//lib/dry/types/sum.rb#16
|
3864
|
+
def optional?; end
|
3865
|
+
|
3866
|
+
# @api private
|
3867
|
+
# @param value [Object]
|
3868
|
+
# @return [Boolean]
|
3869
|
+
#
|
3870
|
+
# source://dry-types//lib/dry/types/sum.rb#56
|
3871
|
+
def primitive?(value); end
|
3872
|
+
|
3873
|
+
# @api public
|
3874
|
+
# @param input [Object]
|
3875
|
+
#
|
3876
|
+
# source://dry-types//lib/dry/types/sum.rb#39
|
3877
|
+
def try(input); end
|
3878
|
+
|
3879
|
+
class << self
|
3880
|
+
# source://dry-types//lib/dry/types/composition.rb#40
|
3881
|
+
def ast_type; end
|
3882
|
+
|
3883
|
+
# source://dry-types//lib/dry/types/composition.rb#41
|
3884
|
+
def composition_name; end
|
3885
|
+
|
3886
|
+
# @api public
|
3887
|
+
#
|
3888
|
+
# source://dry-types//lib/dry/types/sum.rb#11
|
3889
|
+
def operator; end
|
3890
|
+
end
|
3891
|
+
end
|
3892
|
+
|
3893
|
+
# source://dry-types//lib/dry/types/sum.rb#0
|
3894
|
+
class Dry::Types::Sum::Constrained < ::Dry::Types::Sum
|
3895
|
+
include ::Dry::Types::Composition::Constrained
|
3896
|
+
end
|
3897
|
+
|
3898
|
+
# @api public
|
3899
|
+
#
|
3900
|
+
# source://dry-types//lib/dry/types.rb#31
|
3901
|
+
Dry::Types::TYPE_SPEC_REGEX = T.let(T.unsafe(nil), Regexp)
|
3902
|
+
|
3903
|
+
# Common Type module denoting an object is a Type
|
3904
|
+
#
|
3905
|
+
# @api public
|
3906
|
+
#
|
3907
|
+
# source://dry-types//lib/dry/types/type.rb#8
|
3908
|
+
module Dry::Types::Type
|
3909
|
+
extend ::Dry::Core::Deprecations::Interface
|
3910
|
+
|
3911
|
+
# Whether a value is a valid member of the type
|
3912
|
+
# Anything can be coerced matches
|
3913
|
+
#
|
3914
|
+
# @api private
|
3915
|
+
# @return [Boolean]
|
3916
|
+
#
|
3917
|
+
# source://dry-types//lib/dry/types/type.rb#18
|
3918
|
+
def ===(input = T.unsafe(nil)); end
|
3919
|
+
|
3920
|
+
# Apply type to a value
|
3921
|
+
#
|
3922
|
+
# @api public
|
3923
|
+
# @overload call
|
3924
|
+
# @overload call
|
3925
|
+
#
|
3926
|
+
# source://dry-types//lib/dry/types/type.rb#43
|
3927
|
+
def [](input = T.unsafe(nil), &_arg1); end
|
3928
|
+
|
3929
|
+
# Apply type to a value
|
3930
|
+
#
|
3931
|
+
# @api public
|
3932
|
+
# @overload call
|
3933
|
+
# @overload call
|
3934
|
+
#
|
3935
|
+
# source://dry-types//lib/dry/types/type.rb#43
|
3936
|
+
def call(input = T.unsafe(nil), &_arg1); end
|
3937
|
+
|
3938
|
+
# source://dry-core/1.1.0/lib/dry/core/deprecations.rb#168
|
3939
|
+
def safe(*args, &block); end
|
3940
|
+
|
3941
|
+
# Whether a value is a valid member of the type
|
3942
|
+
#
|
3943
|
+
# @api private
|
3944
|
+
# @return [Boolean]
|
3945
|
+
#
|
3946
|
+
# source://dry-types//lib/dry/types/type.rb#18
|
3947
|
+
def valid?(input = T.unsafe(nil)); end
|
3948
|
+
end
|
3949
|
+
|
3950
|
+
# @api public
|
3951
|
+
#
|
3952
|
+
# source://dry-types//lib/dry/types/errors.rb#101
|
3953
|
+
class Dry::Types::UnknownKeysError < ::Dry::Types::SchemaKeyError
|
3954
|
+
# @api public
|
3955
|
+
# @param keys [<String, Symbol>]
|
3956
|
+
# @return [UnknownKeysError] a new instance of UnknownKeysError
|
3957
|
+
#
|
3958
|
+
# source://dry-types//lib/dry/types/errors.rb#106
|
3959
|
+
def initialize(keys); end
|
3960
|
+
|
3961
|
+
# @api public
|
3962
|
+
# @return [Array<Symbol>]
|
3963
|
+
#
|
3964
|
+
# source://dry-types//lib/dry/types/errors.rb#103
|
3965
|
+
def keys; end
|
3966
|
+
end
|
3967
|
+
|
3968
|
+
# source://dry-types//lib/dry/types/version.rb#5
|
3969
|
+
Dry::Types::VERSION = T.let(T.unsafe(nil), String)
|