Recent Releases of https://github.com/dry-rb/dry-types
https://github.com/dry-rb/dry-types - v1.8.3
Fixed
- Raise error on passing a non-module object to Instance (ref #480) (@flash-gordon)
- Ruby
Published by dry-bot 7 months ago
https://github.com/dry-rb/dry-types - v1.8.2
Fixed
- Syntax errors on 3.3.0 (@flash-gordon, see #478)
- Ruby
Published by dry-bot 12 months ago
https://github.com/dry-rb/dry-types - v1.8.1
Fixed
- Warnings about unused block arguments (@flash-gordon, #477)
- Ruby
Published by dry-bot 12 months ago
https://github.com/dry-rb/dry-types - v1.8.0
Added
- Added
Enum#each_valueto iterate over enum values (@CharlieWWW94 in #471)
Fixed
- Fixed
Default#tryto return correct result (@elcuervo + @flash-gordon in #475)
Changed
- Set min Ruby version to 3.1 (@flash-gordon)
- Better representation of Enum types (@flash-gordon, see #460)
- Ruby
Published by dry-bot about 1 year ago
https://github.com/dry-rb/dry-types - v1.7.2
Fixed
- Fixed BigDecimal warning due to not being required in gemspec (@bkuhlmann in #464)
- Ruby
Published by dry-bot about 2 years ago
https://github.com/dry-rb/dry-types - v1.7.1
Fixed
- Warning from jruby about overwritten keyword (@flash-gordon + @klobuczek in #454)
- Ruby
Published by dry-bot almost 3 years ago
https://github.com/dry-rb/dry-types - v1.7.0
Changed
- This version is compatible with recently released dry-rb dependencies (@flash-gordon)
- Updated to dry-core 1.0 (@flash-gordon + @solnic)
- Dependency on dry-container was dropped (@flash-gordon)
- Ruby
Published by dry-bot about 3 years ago
https://github.com/dry-rb/dry-types - v1.6.1
Changed
- Fix issues with internal const_missing and Inflector/Module constants (@flash-gordon + @solnic)
- Ruby
Published by dry-bot about 3 years ago
https://github.com/dry-rb/dry-types - v1.6.0
Changed
- Optimize
PredicateRegistryfor Ruby 2.7+ (see #420 for more details) (@casperisfine) - Use zeitwerk for auto-loading (@flash-gordon)
- Ruby
Published by dry-bot about 3 years ago
https://github.com/dry-rb/dry-types - v1.5.1
Fixed
- Add missing requires for internal usage of
Dry::Equalizer(@timriley in #418)
- Ruby
Published by dry-bot almost 5 years ago
https://github.com/dry-rb/dry-types - v1.5.0
Added
-
Wrapping constructor types 🎉 (@flash-gordon)
Constructor blocks can have a second argument.
The second argument is the underlying type itself:age_from_year = Dry::Types['coercible.integer'].constructor do |input, type| Date.today.year - type.(input) end age_from_year.('2000') # => 21With wrapping constructors you have control over "type application". You can even
run it more than once:inc = Dry::Types['integer'].constructor(&:succ) inc2x = inc.constructor { _2.(_2.(_2.(_1))) } inc2x.(10) # => 13 -
Fallbacks 🎉 (@flash-gordon)
age = Dry::Types['coercible.ineger'].fallback(18) age.('10') # => 10 age.('20') # => 20 age.('abc') # => 18Fallbacks are different from default values: the later will be evaluated
only when no input provided.Under the hood,
.fallbackcreates a wrapping constructor. -
params.stringas an alias forstrict.string. This addition should be non-breaking (@flash-gordon) -
API for defining custom type builders similar to
.default,.constructor, or.optional(@flash-gordon)# Making an alias for `.fallback` Dry::Types.define_builder(:or) { |type, v| type.fallback(v) } # Using new builder type = Dry::Types['integer'].or(-273) type.(:invalid) # => -273
Changed
-
Inferring predicates from class names is deprecated. It's very unlikely your code depends on it,
however, if it does, you'll get an exception with instructions. (@flash-gordon)If you don't rely on inferring, just disable it with:
Dry::Types::PredicateInferrer::Compiler.infer_predicate_by_class_name falseOtherwise, enable it explicitly:
Dry::Types::PredicateInferrer::Compiler.infer_predicate_by_class_name true
- Ruby
Published by dry-bot almost 5 years ago
https://github.com/dry-rb/dry-types -
1.4.0 2020-03-09
Fixed
json.nilno longer coerces empty strings tonil. It was a long-standing
bug that for some reason remained unnoticed for years. Technically,
this may be a breaking change for JSON schemas described with dry-schema (@flash-gordon)
- Ruby
Published by flash-gordon almost 6 years ago
https://github.com/dry-rb/dry-types -
1.3.1 2020-02-17
Changed
- Predicate inferrer now returns
hash?for hash schemas. Note, it doesn't spit more complex preds because we have different plans for dry-schema (@flash-gordon)
- Ruby
Published by flash-gordon almost 6 years ago
https://github.com/dry-rb/dry-types -
Added
Schema#mergefor merging two hash schemas (@waiting-for-dev)- Aliases for
.constructorto non-constructor types. Now you can call.prepend/.appendwithout silly checks for the type being a constructor (flash-gordon)(Dry::Types['integer'].prepend(-> { _1 + 1 })).(1) # => 2 (Dry::Types['coercible.integer'] >> -> { _1 * 2 }).('99') # => 198 Hash::Schema#clearreturns a schema with the same options but without keys- Optional namespace now includes strict types by default (@flash-gordon)
Fixed
Schema::Key#optionalreturns an instance ofSchema::Keyas it should have done- Composition with function handling exceptions. This could occasionally lead to unexpected exceptions (@flash-gordon)
- Ruby
Published by flash-gordon almost 6 years ago
https://github.com/dry-rb/dry-types -
1.2.2 2019-12-14
Fixed
Types.Contructordoesn't re-wrap class instances implementing type interface, this fixes some quirks in dry-struct (flash-gordon)
Changed
- Types now use immutable equalizers. This should improve performance in certain cases e.g. in ROM (flash-gordon)
- Attempting to use non-symbol keys in hash schemas raises an error. We always supported only symbols as keys, but there was no check, now it'll throw an argument error. If you want to convert strings to symbols, use
Hash#with_key_transform(flash-gordon) - Params and JSON types accept Time/Date/Datetime instances and boolean values. This can be useful in tests, but we discourage you from relying on this behavior in production code. For example, building structs with
Paramstypes is considered a smell. There are dedicated tools for coercion, namely dry-schema and dry-validation. Be a responsible user of dry-types! ❤ (flash-gordon)
- Ruby
Published by flash-gordon about 6 years ago
https://github.com/dry-rb/dry-types -
1.2.1 2019-11-07
Fixed
- Fix keyword warnings reported by Ruby 2.7 (flash-gordon)
- Error type in failing case in
Array::Member(esparta)
- Ruby
Published by flash-gordon about 6 years ago
https://github.com/dry-rb/dry-types -
1.2.0 2019-10-06
Changed
Dry::Types.[]used to work with classes, now it's deprecated (flash-gordon)
Fixed
- Bug with using a
Bool-named struct as a schema key (flash-gordon) - A bunch of issues related to using
metaon complex types (flash-gordon) Types.Constructor(...)returns aTypes::Arrayas it should (flash-gordon)
Added
-
Optional::Paramstypes that coerce empty strings tonil(flash-gordon)Dry::Types['optional.params.integer'].('') # => nil Dry::Types['optional.params.integer'].('140') # => 140 Dry::Types['optional.params.integer'].('asd') # => exception!Keep in mind, Dry::Types['optional.params.integer'] and Dry::Types['params.integer'].optional are not the same, the latter doesn't handle empty strings.
-
Predicate inferrer was ported from dry-schema (authored by solnic)
require 'dry/types/predicate_inferrer' Dry::Types::PredicateInferrer.new[Types::String] # => [:str?] Dry::Types::PredicateInferrer.new[Types::String | Types::Integer] # => [[[:str?], [:int?]]]Note that the API of the predicate inferrer can change in the stable version, it's dictated by the needs of dry-schema so it should be considered as semi-stable. If you depend on it, write specs covering the desired behavior. Another option is copy-and-paste the whole thing to your project.
-
Primitive inferrer was ported from dry-schema (authored by solnic)
require 'dry/types/primitive_inferrer' Dry::Types::PrimitiveInferrer.new[Types::String] # => [String] Dry::Types::PrimitiveInferrer.new[Types::String | Types::Integer] # => [String, Integer] Dry::Types::PrimitiveInferrer.new[Types::String.optional] # => [NilClass, String]The primitive inferrer should be stable by now, you can rely on it.
-
The
monadsextension addsDry::Types::Result#to_monad. This makes it compatible with do notation from dry-monads. Load it withDry::Types.load_extensions(:monads)(skryukov)Types = Dry.Types Dry::Types.load_extensions(:monads) class AddTen include Dry::Monads[:result, :do] def call(input) integer = yield Types::Coercible::Integer.try(input) Success(integer + 10) end end
- Ruby
Published by flash-gordon over 6 years ago
https://github.com/dry-rb/dry-types -
1.1.1 2019-07-26
Fixed
- A bug where meta was lost for lax array types (flash-gordon)
- Ruby
Published by flash-gordon over 6 years ago
https://github.com/dry-rb/dry-types -
1.1.0 2019-07-02
Added
- New builder method
Interfaceconstructs a type which accepts objects that respond to the given methods (waiting-for-dev)Types = Dry.Types() Types::Callable = Types.Interface(:call) Types::Callable.valid?(Object.new) # => false Types::Callable.valid?(proc {}) # => true - New types:
coercible.symbol,params.symbol, andjson.symbol, all use.to_symfor coercion (waiting-for-dev)
Fixed
- Converting schema keys to maybe types (flash-gordon)
- Using
Schema#keyandArray#memberon constuctors (flash-gordon) - Using
meta(omittable: true)withintransform_typesworks again but produces a warning, please migrate to.omittableor.required(false)(flash-gordon) - Bug with a constructor defined on top of enum (flash-gordon)
- Ruby
Published by flash-gordon over 6 years ago
https://github.com/dry-rb/dry-types -
1.0.1 2019-06-04
Added
- In a case of failure the constructor block can now pass a different value (flash-gordon)
not_empty_string = Types::String.constructor do |value, &failure| value.strip.empty? ? failure.(nil) : value.strip end not_empty_string.(' ') { |v| v } # => nil not_empty_string.lax.(' ') # => nil not_empty_string.lax.(' foo ') # => "foo" Schema#strictnow accepts an boolean argument. Iffalesis passed this will turn a strict schema into a non-strict one (flash-gordon)
- Ruby
Published by flash-gordon over 6 years ago
https://github.com/dry-rb/dry-types -
1.0.0 2019-04-23
Changed
-
[BREAKING] Behavior of built-in constructor types was changed to be more strict. They will always raise an error on failed coercion (flash-gordon)
Compare:# 0.15.0 Types::Params::Integer.('foo') # => "foo" # 1.0.0 Types::Params::Integer.('foo') # => Dry::Types::CoercionError: invalid value for Integer(): "foo"To handle coercion errors
Type#callnow yields a block:Types::Params::Integer.('foo') { :invalid } # => :invalidThis makes work with coercions more straightforward and way faster.
-
[BREAKING] Safe types were renamed to Lax, this name better serves their purpose. The previous name is available but prints a warning (flash-gordon)
-
[BREAKING] Metadata is now pushed down to the decorated type. It is not likely you will notice a difference but this a breaking change that enables some use cases in rom related to the usage of default types in relations (flash-gordon)
-
Nominal types are now completely unconstrained. This fixes some inconsistencies when using them with constraints.
Nominal#trywill always return a successful result, for the previous behavior useNominal#try_coerceor switch to strict types with passing a block to#call(flash-gordon)
Performance improvements
- During the work on this release, a lot of performance improvements were made. dry-types 1.0 combined with dry-logic 1.0 are multiple times faster than dry-types 0.15 and dry-logic 0.5 for common cases including constraints checking and coercion (flash-gordon)
Added
- API for custom constructor types was enhanced. If you pass your own callable to
.constructorit can have a block in its signature. If a block is passed, you must call it on failed coercion, otherwise raise a type coercion error (flash-gordon)
Example:
This makes the exception handling your job so that dry-types won't have to catch and re-wrap all possible errors (this is not safe, generally speaking).proc do |input, &block| if input.is_a? String Integer(input, 10) else Integer(input) end rescue ArgumentError, TypeError => error if block block.call else raise Dry::Types::CoercionError.new( error.message, backtrace: error.backtrace ) end end - Types now can be converted to procs thus you can pass them as blocks (flash-gordon)
%w(1 2 3).map(&Types::Coercible::Integer) # => [1, 2, 3]
- Ruby
Published by flash-gordon over 6 years ago
https://github.com/dry-rb/dry-types -
v0.14.1 2019-03-25
Fixed
coercible.integernow doesn't blow up on invalid strings (exterm)
- Ruby
Published by flash-gordon almost 7 years ago
https://github.com/dry-rb/dry-types -
0.15.0 2019-03-22
Changed
- [BREAKING] Internal representation of hash schemas was changed to be a simple list of key types (flash-gordon)
Dry::Types::Hash#with_type_transformnow yields a key type instead of type + name:Dry::Types['strict.hash'].with_type_transform { |key| key.name == :age ? key.required(false) : key } - [BREAKING] Definition types were renamed to nominal (flash-gordon)
- [BREAKING] Top-level types returned by
Dry::Types.[]are now strict (flash-gordon)# before Dry::Types['integer'] # => #<Dry::Types[Nominal<Integer>]> # now Dry::Types['integer'] # => <Dry::Types[Constrained<Nominal<Integer> rule=[type?(Integer)]>]> # you can still access nominal types using namespace Dry::Types['nominal.integer'] # => #<Dry::Types[Nominal<Integer>]> - [BREAKING] Default values are not evaluated if the decorated type returns
nil. They are triggered onUndefinedinstead (GustavoCaso + flash-gordon) - [BREAKING] Support for old hash schemas was fully removed. This makes dry-types not compatible with dry-validation < 1.0 (flash-gordon)
Dry::Types.moduleis deprecated in favor ofDry.Types(flash-gordon)
Keep in mindDry.Typesuses strict types for top-level names, that is aftermodule Types include Dry.Types endTypes::Integeris a strict type. If you want it to be nominal, useinclude Dry.Types(default: :nominal). See other options below.params.integernow always converts strings to decimal numbers, this means09will be coerced to9(threw an error before) (skryukov)- Ruby 2.3 is EOL and not officially supported. It may work but we don't test it.
Added
- Improved string representation of types (flash-gordon)
Dry::Types['nominal.integer'] # => #<Dry::Types[Nominal<Integer>]> Dry::Types['params.integer'] # => #<Dry::Types[Constructor<Nominal<Integer> fn=Dry::Types::Coercions::Params.to_int>]> Dry::Types['hash'].schema(age?: 'integer') # => #<Dry::Types[Constrained<Schema<keys={age?: Constrained<Nominal<Integer> rule=[type?(Integer)]>}> rule=[type?(Hash)]>]> Dry::Types['array<integer>'] # => #<Dry::Types[Constrained<Array<Constrained<Nominal<Integer> rule=[type?(Integer)]>> rule=[type?(Array)]>]> - Options for the list of types you want to import with
Dry.Types(flash-gordon)
Cherry-pick only certain types:
Change default top-level types:module Types include Dry.Types(:strict, :nominal, :coercible) end Types.constants # => [:Strict, :Nominal, :Coercible]
Rename type namespaces:module Types include Dry.Types(default: :coercible) end # => #<Dry::Types[Constructor<Nominal<Integer> fn=Kernel.Integer>]>module Types include Dry.Types(strict: :Strong, coercible: :Kernel) end - Optional keys for schemas can be provided with ?-ending symbols (flash-gordon)
Dry::Types['hash'].schema(name: 'string', age?: 'integer') - Another way of making keys optional is setting
required: falseto meta. In fact, it is the preferable
way if you have to store this information inmeta, otherwise use the Key's API (see below) (flash-gordon)Dry::Types['hash'].schema( name: Dry::Types['string'], age: Dry::Types['integer'].meta(required: false) ) - Key types have API for making keys omittable and back (flash-gordon)
# defining a base schema with optional keys lax_hash = Dry::Types['hash'].with_type_transform { |key| key.required(false) } # same as lax_hash = Dry::Types['hash'].with_type_transform(&:omittable) # keys in user_schema are not required user_schema = lax_hash.schema(name: 'string', age: 'integer') Type#optional?now recognizes more cases wherenilis an allowed value (flash-gordon)Constructor#{prepend,append}with<<and>>as aliases.Constructor#appendworks the same wayConstructor#constrcutordoes.Constuctor#prependchains functions in the reverse order, see examples (flash-gordon)to_int = Types::Coercible::Integer inc = to_int.append { |x| x + 2 } inc.("1") # => "1" -> 1 -> 3 inc = to_int.prepend { |x| x + "2" } inc.("1") # => "1" -> "12" -> 12- Partial schema application for cases when you want to validate only a subset of keys (flash-gordon)
This is useful when you want to update a key or two in an already-validated hash. A perfect example isDry::Struct#newwhere this feature is now used.schema = Dry::Types['hash'].schema(name: 'string', age: 'integer') value = schema.(name: 'John', age: 20) update = schema.apply({ age: 21 }, skip_missing: true) value.merge(update)
Fixed
Hash::Mapnow behaves as a constrained type if its values are constrained (flash-gordon)coercible.integernow doesn't blow up on invalid strings (exterm)
- Ruby
Published by flash-gordon almost 7 years ago
https://github.com/dry-rb/dry-types -
0.14.0 2019-01-29
Changed
- [BREAKING] Support for Ruby 2.2 was dropped. It reached EOL on March 31, 2018.
dry-logicwas updated to~> 0.5(solnic)
Fixed
valid?works correctly with constructors now (cgeorgii)
- Ruby
Published by flash-gordon almost 7 years ago
https://github.com/dry-rb/dry-types -
v0.13.4 2018-12-21
Fixed
- Fixed warnings about keyword arguments from Ruby 2.6. See https://bugs.ruby-lang.org/issues/14183 for all the details (flash-gordon)
- Ruby
Published by flash-gordon about 7 years ago
https://github.com/dry-rb/dry-types -
v0.13.3 2018-11-25
Fixed
Dry::Types::Hash#tryreturnsFailureinstead of throwing an exception on missing keys (GustavoCaso)
- Ruby
Published by flash-gordon about 7 years ago
https://github.com/dry-rb/dry-types -
v0.12.3 2018-06-12
Fixed
- Fixed
constrained?for constructor types (solnic)
- Ruby
Published by flash-gordon over 7 years ago
https://github.com/dry-rb/dry-types -
v0.13.2 2018-05-30
Fixed
Defaults#valid?now works fine when passingDry::Core::Constans::Undefinedas value (GustavoCaso)valid?for constructor types wrappingSums (GustavoCaso)
- Ruby
Published by flash-gordon over 7 years ago
https://github.com/dry-rb/dry-types -
v0.13.1 2018-05-28
Fixed
- Defaults now works fine with meta (GustavoCaso)
- Defaults are now re-decorated properly (flash-gordon)
Added
params.intwas added to make the upgrade process in dry-validation smoother (available after yourequire 'dry/types/compat/int') (flash-gordon)
- Ruby
Published by flash-gordon over 7 years ago
https://github.com/dry-rb/dry-types -
v0.13.0 2018-05-03
Changed
- [BREAKING] Renamed
Types::FormtoTypes::Params. You can opt-in the former name withrequire 'dry/types/compat/form_types'. It will be dropped in the next release (ndrluis) - [BREAKING] The
Inttypes was renamed toInteger, this was the only type named differently from the standard Ruby classes so it has been made consistent. The former name is available withrequire 'dry/types/compat/int'(GustavoCaso + flash-gordon) - [BREAKING] Default types are not evaluated on
nil. Default values are evaluated only if no value were given.
This change allowed to greatly simplify hash schemas, make them a lot more flexible yet predictable (see below).type = Types::Strict::String.default("hello") type[nil] # => constraint error type[] # => "hello" - [BREAKING]
Dry::Types.register_classwas removed,Dry::Types.registerwas made private API, do not register your types in the globaldry-typescontainer, use a module instead, e.g.Types(flash-gordon) - [BREAKING] Enum types don't accept value index anymore. Instead, explicit mapping is supported, see below (flash-gordon)
Added
-
Hash schemas were rewritten. The old API is still around but is going to be deprecated and removed before 1.0. The new API is simpler and more flexible. Instead of having a bunch of predefined schemas you can build your own by combining the following methods:
Schema#with_key_transform—transforms keys of input hashes, for things like symbolizing etc.Schema#strict—makes a schema intolerant to unknown keys.Hash#with_type_transform—transforms member types with an arbitrary block. For instance,
optional_keys = Types::Hash.with_type_transform { |t, _key| t.optional } schema = optional_keys.schema(name: 'strict.string', age: 'strict.int') schema.(name: "Jane", age: nil) # => {name: "Jane", age: nil}Note that by default all keys are required, if a key is expected to absent, add to the corresponding type's meta
omittable: true:intolerant = Types::Hash.schema(name: Types::Strict::String) intolerant[{}] # => Dry::Types::MissingKeyError tolerant = Types::Hash.schema(name: Types::Strict::String.meta(omittable: true)) tolerant[{}] # => {} tolerant_with_default = Types::Hash.schema(name: Types::Strict::String.meta(omittable: true).default("John")) tolerant[{}] # => {name: "John"}The new API is composable in a natural way:
TOLERANT = Types::Hash.with_type_transform { |t| t.meta(omittable: true) }.freeze user = TOLERANT.schema(name: 'strict.string', age: 'strict.int') user.(name: "Jane") # => {name: "Jane"} TOLERANT_SYMBOLIZED = TOLERANT.with_key_transform(&:to_sym) user_sym = TOLERANT_SYMBOLIZED.schema(name: 'strict.string', age: 'strict.int') user_sym.("name" => "Jane") # => {name: "Jane"}(flash-gordon)
-
Types.Strictis an alias forTypes.Instance(flash-gordon)strict_range = Types.Strict(Range) strict_range == Types.Instance(Range) # => true -
Enum#include?is an alias toEnum#valud?(d-Pixie + flash-gordon) -
Rangewas added (GustavoCaso) -
Arraytypes filter outUndefinedvalues, if you have an array type with a constructor type as its member, the constructor now can returnDry::Types::Undefinedto indicate empty value:filter_empty_strings = Types::Strict::Array.of( Types::Strict::String.constructor { |input| input.to_s.yield_self { |s| s.empty? ? Dry::Types::Undefined : s } } ) filter_empty_strings.(["John", nil, "", "Jane"]) # => ["John", "Jane"] -
Types::Mapwas added for homogeneous hashes, when only types of keys and values are known in advance, not specific key names (fledman + flash-gordon)int_to_string = Types::Hash.map('strict.integer', 'strict.string') int_to_string[0 => 'foo'] # => { 0 => "foo" } int_to_string[0 => 1] # Dry::Types::MapError: input value 1 for key 0 is invalid: type?(String, 1) -
Enum supports mappings (bolshakov + flash-gordon)
dict = Types::Strict::String.enum('draft' => 0, 'published' => 10, 'archived' => 20) dict['published'] # => 'published' dict[10] # => 'published'
Fixed
- Fixed applying constraints to optional type, i.e.
.optional.constrainedworks correctly (flash-gordon) - Fixed enum working with optionals (flash-gordon)
Internal
- Dropped the
dry-configurabledependency (GustavoCaso) - The gem now uses
dry-inflectorfor inflections instead ofinflecto(GustavoCaso)
- Ruby
Published by flash-gordon over 7 years ago
https://github.com/dry-rb/dry-types -
v0.12.2 2017-11-04
Fixed
- The type compiler was fixed for simple rules such as used for strict type checks (flash-gordon)
- Fixed an error on
Dry::Types['json.decimal'].try(nil)(nesaulov) - Fixed an error on calling
tryon an array type built of constrained types (flash-gordon) - Implemented
===for enum types (GustavoCaso)
- Ruby
Published by flash-gordon about 8 years ago
https://github.com/dry-rb/dry-types -
v0.12.1 2017-10-11
Fixed
Constructor#tryrescuesArgumentError(raised in cases likeInteger('foo')) (flash-gordon)#constructorworks correctly for default and enum types (solnic)- Optional sum types work correctly in
safemode (GustavoCaso) - The equalizer of constrained types respects meta (flash-gordon)
- Ruby
Published by flash-gordon about 8 years ago
https://github.com/dry-rb/dry-types -
v0.12.0 2017-09-15
Added
- A bunch of shortcut methods for constructing types to the autogenerated module, e.g.
Types.Constructor(String, &:to_s)(flash-gordon)
Deprecated
Types::Array#memberwas deprecated in favor ofTypes::Array#of(flash-gordon)
- Ruby
Published by flash-gordon about 8 years ago
https://github.com/dry-rb/dry-types -
v0.11.1 2017-08-14
Changed
- Constructors are now equalized using
fnandmetatoo (flash-gordon)
Fixed
- Fixed
Constructor#namewithSum-types (flash-gordon)
- Ruby
Published by flash-gordon about 8 years ago
https://github.com/dry-rb/dry-types - v0.11.0
Added
#to_astavailable for all type objects (GustavoCaso)Types::Array#ofas an alias for#member(maliqq)- Detailed failure objects are passed to results which improves constraint violation messages (GustavoCaso)
- Ruby
Published by solnic over 8 years ago
https://github.com/dry-rb/dry-types -
Added
- Callable defaults accept the underlying type (v-kolesnikov)
- Ruby
Published by flash-gordon over 8 years ago
https://github.com/dry-rb/dry-types -
Added
Type#optional?returns true if type is Sum and left is nil (GustavoCaso)Type#pristinereturns a type withoutmeta(flash-gordon)
Fixed
metais used in type equality again (solnic)Anyworks correctly with meta again (flash-gordon)
- Ruby
Published by flash-gordon over 8 years ago
https://github.com/dry-rb/dry-types -
Added
- Types can be used in
casestatements now (GustavoCaso)
Fixed
- Return original value when Date.parse raises a RangeError (jviney)
Changed
- Meta data are now stored separately from options (flash-gordon)
Types::Objectwas renamed toTypes::Any(flash-gordon)
- Ruby
Published by flash-gordon over 8 years ago
https://github.com/dry-rb/dry-types -
Fixed
- Fixed
Type#optional?for sum types (flash-gordon)
- Ruby
Published by flash-gordon over 8 years ago