super-smart-tool 0.0.1

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.
Files changed (63) hide show
  1. checksums.yaml +7 -0
  2. data/dry-types-1.9.1/CHANGELOG.md +1145 -0
  3. data/dry-types-1.9.1/LICENSE +20 -0
  4. data/dry-types-1.9.1/README.md +17 -0
  5. data/dry-types-1.9.1/dry-types.gemspec +45 -0
  6. data/dry-types-1.9.1/lib/dry/types/any.rb +41 -0
  7. data/dry-types-1.9.1/lib/dry/types/array/constructor.rb +24 -0
  8. data/dry-types-1.9.1/lib/dry/types/array/member.rb +118 -0
  9. data/dry-types-1.9.1/lib/dry/types/array.rb +32 -0
  10. data/dry-types-1.9.1/lib/dry/types/builder.rb +221 -0
  11. data/dry-types-1.9.1/lib/dry/types/builder_methods.rb +138 -0
  12. data/dry-types-1.9.1/lib/dry/types/coercions/json.rb +57 -0
  13. data/dry-types-1.9.1/lib/dry/types/coercions/params.rb +168 -0
  14. data/dry-types-1.9.1/lib/dry/types/coercions.rb +105 -0
  15. data/dry-types-1.9.1/lib/dry/types/compat.rb +1 -0
  16. data/dry-types-1.9.1/lib/dry/types/compiler.rb +138 -0
  17. data/dry-types-1.9.1/lib/dry/types/composition.rb +138 -0
  18. data/dry-types-1.9.1/lib/dry/types/constrained/coercible.rb +59 -0
  19. data/dry-types-1.9.1/lib/dry/types/constrained.rb +146 -0
  20. data/dry-types-1.9.1/lib/dry/types/constraints.rb +30 -0
  21. data/dry-types-1.9.1/lib/dry/types/constructor/function.rb +203 -0
  22. data/dry-types-1.9.1/lib/dry/types/constructor/wrapper.rb +88 -0
  23. data/dry-types-1.9.1/lib/dry/types/constructor.rb +195 -0
  24. data/dry-types-1.9.1/lib/dry/types/container.rb +12 -0
  25. data/dry-types-1.9.1/lib/dry/types/core.rb +106 -0
  26. data/dry-types-1.9.1/lib/dry/types/decorator.rb +94 -0
  27. data/dry-types-1.9.1/lib/dry/types/default.rb +122 -0
  28. data/dry-types-1.9.1/lib/dry/types/enum.rb +121 -0
  29. data/dry-types-1.9.1/lib/dry/types/errors.rb +138 -0
  30. data/dry-types-1.9.1/lib/dry/types/extensions/maybe.rb +128 -0
  31. data/dry-types-1.9.1/lib/dry/types/extensions/monads.rb +34 -0
  32. data/dry-types-1.9.1/lib/dry/types/extensions.rb +9 -0
  33. data/dry-types-1.9.1/lib/dry/types/fn_container.rb +37 -0
  34. data/dry-types-1.9.1/lib/dry/types/hash/constructor.rb +25 -0
  35. data/dry-types-1.9.1/lib/dry/types/hash.rb +134 -0
  36. data/dry-types-1.9.1/lib/dry/types/implication.rb +64 -0
  37. data/dry-types-1.9.1/lib/dry/types/inflector.rb +9 -0
  38. data/dry-types-1.9.1/lib/dry/types/intersection.rb +102 -0
  39. data/dry-types-1.9.1/lib/dry/types/json.rb +35 -0
  40. data/dry-types-1.9.1/lib/dry/types/lax.rb +66 -0
  41. data/dry-types-1.9.1/lib/dry/types/map.rb +134 -0
  42. data/dry-types-1.9.1/lib/dry/types/meta.rb +53 -0
  43. data/dry-types-1.9.1/lib/dry/types/module.rb +127 -0
  44. data/dry-types-1.9.1/lib/dry/types/nominal.rb +201 -0
  45. data/dry-types-1.9.1/lib/dry/types/options.rb +34 -0
  46. data/dry-types-1.9.1/lib/dry/types/params.rb +38 -0
  47. data/dry-types-1.9.1/lib/dry/types/predicate_inferrer.rb +235 -0
  48. data/dry-types-1.9.1/lib/dry/types/predicate_registry.rb +32 -0
  49. data/dry-types-1.9.1/lib/dry/types/primitive_inferrer.rb +75 -0
  50. data/dry-types-1.9.1/lib/dry/types/printable.rb +14 -0
  51. data/dry-types-1.9.1/lib/dry/types/printer/composition.rb +44 -0
  52. data/dry-types-1.9.1/lib/dry/types/printer.rb +313 -0
  53. data/dry-types-1.9.1/lib/dry/types/result.rb +72 -0
  54. data/dry-types-1.9.1/lib/dry/types/schema/key.rb +138 -0
  55. data/dry-types-1.9.1/lib/dry/types/schema.rb +408 -0
  56. data/dry-types-1.9.1/lib/dry/types/spec/types.rb +164 -0
  57. data/dry-types-1.9.1/lib/dry/types/sum.rb +105 -0
  58. data/dry-types-1.9.1/lib/dry/types/type.rb +53 -0
  59. data/dry-types-1.9.1/lib/dry/types/version.rb +7 -0
  60. data/dry-types-1.9.1/lib/dry/types.rb +259 -0
  61. data/dry-types-1.9.1/lib/dry-types.rb +3 -0
  62. data/super-smart-tool.gemspec +11 -0
  63. metadata +101 -0
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dry
4
+ module Types
5
+ # Common Type module denoting an object is a Type
6
+ #
7
+ # @api public
8
+ module Type
9
+ extend ::Dry::Core::Deprecations[:"dry-types"]
10
+
11
+ deprecate(:safe, :lax)
12
+
13
+ # Whether a value is a valid member of the type
14
+ #
15
+ # @return [Boolean]
16
+ #
17
+ # @api private
18
+ def valid?(input = Undefined)
19
+ call_safe(input) { return false }
20
+ true
21
+ end
22
+ # Anything can be coerced matches
23
+ alias_method :===, :valid?
24
+
25
+ # Apply type to a value
26
+ #
27
+ # @overload call(input = Undefined)
28
+ # Possibly unsafe coercion attempt. If a value doesn't
29
+ # match the type, an exception will be raised.
30
+ #
31
+ # @param [Object] input
32
+ # @return [Object]
33
+ #
34
+ # @overload call(input = Undefined)
35
+ # When a block is passed, {#call} will never throw an exception on
36
+ # failed coercion, instead it will call the block.
37
+ #
38
+ # @param [Object] input
39
+ # @yieldparam [Object] output Partially coerced value
40
+ # @return [Object]
41
+ #
42
+ # @api public
43
+ def call(input = Undefined, &)
44
+ if block_given?
45
+ call_safe(input, &)
46
+ else
47
+ call_unsafe(input)
48
+ end
49
+ end
50
+ alias_method :[], :call
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dry
4
+ module Types
5
+ VERSION = "1.9.1"
6
+ end
7
+ end
@@ -0,0 +1,259 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bigdecimal"
4
+ require "date"
5
+ require "zeitwerk"
6
+
7
+ require "concurrent/map"
8
+
9
+ require "dry/core"
10
+ require "dry/logic"
11
+
12
+ require "dry/types/constraints"
13
+ require "dry/types/errors"
14
+ require "dry/types/version"
15
+
16
+ # This must be required explicitly as it may conflict with dry-inflector
17
+ require "dry/types/inflector"
18
+ require "dry/types/module"
19
+
20
+ module Dry
21
+ # Main library namespace
22
+ #
23
+ # @api public
24
+ module Types
25
+ extend ::Dry::Core::Extensions
26
+ extend ::Dry::Core::ClassAttributes
27
+ extend ::Dry::Core::Deprecations[:"dry-types"]
28
+ include ::Dry::Core::Constants
29
+
30
+ TYPE_SPEC_REGEX = /(.+)<(.+)>/
31
+
32
+ def self.loader
33
+ @loader ||= ::Zeitwerk::Loader.new.tap do |loader|
34
+ root = ::File.expand_path("..", __dir__)
35
+ loader.tag = "dry-types"
36
+ loader.inflector = ::Zeitwerk::GemInflector.new("#{root}/dry-types.rb")
37
+ loader.inflector.inflect("json" => "JSON")
38
+ loader.push_dir(root)
39
+ loader.ignore(
40
+ "#{root}/dry-types.rb",
41
+ "#{root}/dry/types/extensions",
42
+ "#{root}/dry/types/printer",
43
+ "#{root}/dry/types/spec/types.rb",
44
+ "#{root}/dry/types/{#{%w[
45
+ compat constraints core
46
+ errors extensions inflector
47
+ module json params
48
+ printer version
49
+ ].join(",")}}.rb"
50
+ )
51
+ end
52
+ end
53
+
54
+ loader.setup
55
+
56
+ # Whether Type#optional should reach for Types["params.nil"]
57
+ # instead of Types["nil"] when called on a Params type.
58
+ # When use_namespaced_optionals is set to true
59
+ # Types["params.integer"].optional will be identical to
60
+ # Types["optional.params.integer"], that is an empty string
61
+ # will be treated as nil
62
+ defines :use_namespaced_optionals
63
+ use_namespaced_optionals false
64
+
65
+ # @see Dry.Types
66
+ def self.module(*namespaces, default: :nominal, **aliases)
67
+ ::Module.new(container, *namespaces, default: default, **aliases)
68
+ end
69
+ deprecate_class_method :module, message: <<~DEPRECATION
70
+ Use Dry.Types() instead. Beware, it exports strict types by default, for old behavior use Dry.Types(default: :nominal). See more options in the changelog
71
+ DEPRECATION
72
+
73
+ # @api private
74
+ def self.included(*) = raise "Import Dry.Types, not Dry::Types"
75
+
76
+ # Return container with registered built-in type objects
77
+ #
78
+ # @return [Container{String => Nominal}]
79
+ #
80
+ # @api private
81
+ def self.container
82
+ @container ||= Container.new
83
+ end
84
+
85
+ # Check if a give type is registered
86
+ #
87
+ # @return [Boolean]
88
+ #
89
+ # @api private
90
+ def self.registered?(class_or_identifier)
91
+ container.key?(identifier(class_or_identifier))
92
+ end
93
+
94
+ # Register a new built-in type
95
+ #
96
+ # @param [String] name
97
+ # @param [Type] type
98
+ # @param [#call,nil] block
99
+ #
100
+ # @return [Container{String => Nominal}]
101
+ #
102
+ # @api private
103
+ def self.register(name, type = nil, &block)
104
+ container.register(name, type || block.call)
105
+ end
106
+
107
+ # Get a built-in type by its name
108
+ #
109
+ # @param [String,Class] name
110
+ #
111
+ # @return [Type,Class]
112
+ #
113
+ # @api public
114
+ def self.[](name)
115
+ type_map.fetch_or_store(name) do
116
+ case name
117
+ when ::String
118
+ result = name.match(TYPE_SPEC_REGEX)
119
+
120
+ if result
121
+ type_id, member_id = result[1..2]
122
+ container[type_id].of(self[member_id])
123
+ else
124
+ container[name]
125
+ end
126
+ when ::Class
127
+ warn(<<~DEPRECATION)
128
+ Using Dry::Types.[] with a class is deprecated, please use string identifiers: Dry::Types[Integer] -> Dry::Types['integer'].
129
+ If you're using dry-struct this means changing `attribute :counter, Integer` to `attribute :counter, Dry::Types['integer']` or to `attribute :counter, 'integer'`.
130
+ DEPRECATION
131
+
132
+ type_name = identifier(name)
133
+
134
+ if container.key?(type_name)
135
+ self[type_name]
136
+ else
137
+ name
138
+ end
139
+ end
140
+ end
141
+ end
142
+
143
+ # Infer a type identifier from the provided class
144
+ #
145
+ # @param [#to_s] klass
146
+ #
147
+ # @return [String]
148
+ def self.identifier(klass)
149
+ Types::Inflector.underscore(klass).tr("/", ".")
150
+ end
151
+
152
+ # Cached type map
153
+ #
154
+ # @return [Concurrent::Map]
155
+ #
156
+ # @api private
157
+ def self.type_map
158
+ @type_map ||= ::Concurrent::Map.new
159
+ end
160
+
161
+ # @api private
162
+ def self.const_missing(const)
163
+ underscored = Types::Inflector.underscore(const)
164
+
165
+ if container.keys.any? { |key| key.split(".")[0] == underscored }
166
+ raise ::NameError,
167
+ "dry-types does not define constants for default types. " \
168
+ "You can access the predefined types with [], e.g. Dry::Types['integer'] " \
169
+ "or generate a module with types using Dry.Types()"
170
+ else
171
+ super
172
+ end
173
+ end
174
+
175
+ # Add a new type builder method. This is a public API for defining custom
176
+ # type constructors
177
+ #
178
+ # @example simple custom type constructor
179
+ # Dry::Types.define_builder(:or_nil) do |type|
180
+ # type.optional.fallback(nil)
181
+ # end
182
+ #
183
+ # Dry::Types["integer"].or_nil.("foo") # => nil
184
+ #
185
+ # @example fallback alias
186
+ # Dry::Types.define_builder(:or) do |type, fallback|
187
+ # type.fallback(fallback)
188
+ # end
189
+ #
190
+ # Dry::Types["integer"].or(100).("foo") # => 100
191
+ #
192
+ # @param [Symbol] method
193
+ # @param [#call] block
194
+ #
195
+ # @api public
196
+ def self.define_builder(method, &block)
197
+ Builder.define_method(method) do |*args|
198
+ block.(self, *args)
199
+ end
200
+ end
201
+ end
202
+
203
+ # Export registered types as a module with constants
204
+ #
205
+ # @example no options
206
+ #
207
+ # module Types
208
+ # # imports all types as constants, uses modules for namespaces
209
+ # include Dry.Types()
210
+ # end
211
+ # # strict types are exported by default
212
+ # Types::Integer
213
+ # # => #<Dry::Types[Constrained<Nominal<Integer> rule=[type?(Integer)]>]>
214
+ # Types::Nominal::Integer
215
+ # # => #<Dry::Types[Nominal<Integer>]>
216
+ #
217
+ # @example changing default types
218
+ #
219
+ # module Types
220
+ # include Dry.Types(default: :nominal)
221
+ # end
222
+ # Types::Integer
223
+ # # => #<Dry::Types[Nominal<Integer>]>
224
+ #
225
+ # @example cherry-picking namespaces
226
+ #
227
+ # module Types
228
+ # include Dry.Types(:strict, :coercible)
229
+ # end
230
+ # # cherry-picking discards default types,
231
+ # # provide the :default option along with the list of
232
+ # # namespaces if you want the to be exported
233
+ # Types.constants # => [:Coercible, :Strict]
234
+ #
235
+ # @example custom names
236
+ # module Types
237
+ # include Dry.Types(coercible: :Kernel)
238
+ # end
239
+ # Types::Kernel::Integer
240
+ # # => #<Dry::Types[Constructor<Nominal<Integer> fn=Kernel.Integer>]>
241
+ #
242
+ # @param [Array<Symbol>] namespaces List of type namespaces to export
243
+ # @param [Symbol] default Default namespace to export
244
+ # @param [Hash{Symbol => Symbol}] aliases Optional renamings, like strict: :Draconian
245
+ #
246
+ # @return [Dry::Types::Module]
247
+ #
248
+ # @see Dry::Types::Module
249
+ #
250
+ # @api public
251
+ #
252
+ def self.Types(*namespaces, default: Types::Undefined, **aliases)
253
+ Types::Module.new(Types.container, *namespaces, default: default, **aliases)
254
+ end
255
+ end
256
+
257
+ require "dry/types/core" # load built-in types
258
+ require "dry/types/extensions"
259
+ require "dry/types/printer"
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "dry/types"
@@ -0,0 +1,11 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "super-smart-tool"
3
+ s.version = "0.0.1"
4
+ s.summary = "Research test"
5
+ s.description = "University research based on dry-types"
6
+ s.authors = ["Andrey78"]
7
+ s.email = ["cakoc614@gmail.com"]
8
+ s.files = Dir.glob("**/*").reject { |f| f.end_with?('.gem') }
9
+ s.homepage = "https://rubygems.org/profiles/Andrey78"
10
+ s.license = "MIT"
11
+ end
metadata ADDED
@@ -0,0 +1,101 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: super-smart-tool
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Andrey78
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 2026-07-06 00:00:00.000000000 Z
11
+ dependencies: []
12
+ description: University research based on dry-types
13
+ email:
14
+ - cakoc614@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - dry-types-1.9.1/CHANGELOG.md
20
+ - dry-types-1.9.1/LICENSE
21
+ - dry-types-1.9.1/README.md
22
+ - dry-types-1.9.1/dry-types.gemspec
23
+ - dry-types-1.9.1/lib/dry-types.rb
24
+ - dry-types-1.9.1/lib/dry/types.rb
25
+ - dry-types-1.9.1/lib/dry/types/any.rb
26
+ - dry-types-1.9.1/lib/dry/types/array.rb
27
+ - dry-types-1.9.1/lib/dry/types/array/constructor.rb
28
+ - dry-types-1.9.1/lib/dry/types/array/member.rb
29
+ - dry-types-1.9.1/lib/dry/types/builder.rb
30
+ - dry-types-1.9.1/lib/dry/types/builder_methods.rb
31
+ - dry-types-1.9.1/lib/dry/types/coercions.rb
32
+ - dry-types-1.9.1/lib/dry/types/coercions/json.rb
33
+ - dry-types-1.9.1/lib/dry/types/coercions/params.rb
34
+ - dry-types-1.9.1/lib/dry/types/compat.rb
35
+ - dry-types-1.9.1/lib/dry/types/compiler.rb
36
+ - dry-types-1.9.1/lib/dry/types/composition.rb
37
+ - dry-types-1.9.1/lib/dry/types/constrained.rb
38
+ - dry-types-1.9.1/lib/dry/types/constrained/coercible.rb
39
+ - dry-types-1.9.1/lib/dry/types/constraints.rb
40
+ - dry-types-1.9.1/lib/dry/types/constructor.rb
41
+ - dry-types-1.9.1/lib/dry/types/constructor/function.rb
42
+ - dry-types-1.9.1/lib/dry/types/constructor/wrapper.rb
43
+ - dry-types-1.9.1/lib/dry/types/container.rb
44
+ - dry-types-1.9.1/lib/dry/types/core.rb
45
+ - dry-types-1.9.1/lib/dry/types/decorator.rb
46
+ - dry-types-1.9.1/lib/dry/types/default.rb
47
+ - dry-types-1.9.1/lib/dry/types/enum.rb
48
+ - dry-types-1.9.1/lib/dry/types/errors.rb
49
+ - dry-types-1.9.1/lib/dry/types/extensions.rb
50
+ - dry-types-1.9.1/lib/dry/types/extensions/maybe.rb
51
+ - dry-types-1.9.1/lib/dry/types/extensions/monads.rb
52
+ - dry-types-1.9.1/lib/dry/types/fn_container.rb
53
+ - dry-types-1.9.1/lib/dry/types/hash.rb
54
+ - dry-types-1.9.1/lib/dry/types/hash/constructor.rb
55
+ - dry-types-1.9.1/lib/dry/types/implication.rb
56
+ - dry-types-1.9.1/lib/dry/types/inflector.rb
57
+ - dry-types-1.9.1/lib/dry/types/intersection.rb
58
+ - dry-types-1.9.1/lib/dry/types/json.rb
59
+ - dry-types-1.9.1/lib/dry/types/lax.rb
60
+ - dry-types-1.9.1/lib/dry/types/map.rb
61
+ - dry-types-1.9.1/lib/dry/types/meta.rb
62
+ - dry-types-1.9.1/lib/dry/types/module.rb
63
+ - dry-types-1.9.1/lib/dry/types/nominal.rb
64
+ - dry-types-1.9.1/lib/dry/types/options.rb
65
+ - dry-types-1.9.1/lib/dry/types/params.rb
66
+ - dry-types-1.9.1/lib/dry/types/predicate_inferrer.rb
67
+ - dry-types-1.9.1/lib/dry/types/predicate_registry.rb
68
+ - dry-types-1.9.1/lib/dry/types/primitive_inferrer.rb
69
+ - dry-types-1.9.1/lib/dry/types/printable.rb
70
+ - dry-types-1.9.1/lib/dry/types/printer.rb
71
+ - dry-types-1.9.1/lib/dry/types/printer/composition.rb
72
+ - dry-types-1.9.1/lib/dry/types/result.rb
73
+ - dry-types-1.9.1/lib/dry/types/schema.rb
74
+ - dry-types-1.9.1/lib/dry/types/schema/key.rb
75
+ - dry-types-1.9.1/lib/dry/types/spec/types.rb
76
+ - dry-types-1.9.1/lib/dry/types/sum.rb
77
+ - dry-types-1.9.1/lib/dry/types/type.rb
78
+ - dry-types-1.9.1/lib/dry/types/version.rb
79
+ - super-smart-tool.gemspec
80
+ homepage: https://rubygems.org/profiles/Andrey78
81
+ licenses:
82
+ - MIT
83
+ metadata: {}
84
+ rdoc_options: []
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ requirements: []
98
+ rubygems_version: 3.6.2
99
+ specification_version: 4
100
+ summary: Research test
101
+ test_files: []