gems dry-types 1.0.1

latest releases: 1.8.3, 1.8.2, 1.8.1...
6 years ago

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#strict now accepts an boolean argument. If fales is passed this will turn a strict schema into a non-strict one (flash-gordon)

Compare v1.0.0...v1.0.1

Don't miss a new dry-types release

NewReleases is sending notifications on new releases.