[no unreleased changes yet]
- Remove upper bounds on versions for all dependencies
- Enforce only major and minor parts of required Ruby version (loosening the required Ruby version from 3.3.3 to 3.3.0)
- Rename primary branch from
master
tomain
[no unreleased changes yet]
[no unreleased changes yet]
[no unreleased changes yet]
- Update release_assistant
- Use
release_assistant
gem to manage the release process
- Accept
Method
as aCallable
shape definition
- Bump Ruby version from 2.7.0 to 2.7.2
- Move from Travis to GitHub Actions
- Removed
::name
method for anonymous validator class inShaped::Shapes::Class
- Bump
rubocop
to 0.88.0 andrunger_style
to 0.2.3
- Source Rubocop rules/config from
runger_style
gem
- Rename the
Or
shape toAny
- Add a
Method
shape (where the shape description is the name of a method which, when called on a test object, must return a truthy value). This is a breaking change because theShaped::Shape
constructor will now return an instance ofShaped::Shapes::Method
rather thanShaped::Shapes::Equality
when called with a Symbol argument.
- Add an
All
shape (w/ multiple sub-shapes, all of which must be matched)
- Make it possible to specify optional keys in a Hash shape (using an
Or
shape as the value)
- Remove explicit
git push
from release instructions
- Add badges for Dependabot status and RubyGems version
- Update README.md and
bin/release
to reflect release via RubyGems
- Add Travis build status badge to README.md
- Fix bug that would occur in the
Shaped::Shape(...)
constructor when provided with a falsy first argument.
- Document ActiveModel-style validations (which are available for
Shaped::Shapes::Class
)
- Wrap lines in README.md to a max of 100 characters
- Add a table of contents to README.md
- Add
require 'shaped'
to first example in README.md
- Fix typo in test (
@number.event?
=>@number.even?
)
- Fill out the "Usage" section of README.md
- Don't say in installation instructions to list gem in test section of Gemfile.
- Update description(s) to reflect broadened scope of the gem
- Add a
Shaped::Shapes::Callable
shape, which is a shape that is defined by any object that responds to#call
(e.g. a proc or an instance of a class that defines a#call
instance method). This allows for essentially total flexibility in defining/describing the "shape" of an object.
- Add the ability to specify ActiveModel-style validations for
Shaped::Shape::Class
es
- Add tests for invalid
Array
andOr
shape definitions
- Added test coverage tracking via
simplecov
andcodecov
- Major refactor! See details below.
- Remove detailed descriptions of errors ("match failure reasons")
- Remove
Array
andHash
refinements (#has_shape?
) - Removed
Shaped::Array(...)
andShaped::Hash(...)
constructor methods. Now, all shapes are created via a single, unifiedShaped::Shape(...)
method that determines which type of shape to build based on the class of the argument. - Removed
Shaped.lax_mode
andShaped.strict_mode
settings. What was previously calledlax_mode
is now the default, meaning that an empty array will always be considered to match anyShaped::Shapes::Array
.
- Added new shape/matcher types (plus preexisting but relocated
Shaped::Shapes::Array
andShaped::Shapes::Hash
):Shaped::Shapes::Class
Shaped::Shapes::Equality
Shaped::Shapes::Any
- All hashes and arrays in shape definitions are parsed "recursively" as shape definitions. For example, instead of:
Shaped::Array([
Shaped::Hash(
name: String,
emails: Shaped::Hash(
personal: Shaped::Array([String]),
work: Shaped::Array([String]),
),
favorite_numbers: Shaped::Array([Numeric]),
),
])
...one can now simply do:
Shaped::Array([
{
name: String,
emails: {
personal: [String],
work: [String],
},
favorite_numbers: [Numeric],
}
])
- Added
activesupport
as a dependency
- Rename
Shaped::Array#descriptor
andShaped::Hash#descriptor
methods to#to_s
- Add
Shaped::Array
method and class - Add
Array
refinement - Add
Shaped::MatchFailureReason
andShaped::Array#match_failure_reason
- Add
Shaped::Hash
method and class - Add
Hash
refinement - Allow composing Hash and Array shape matchers together
- Fix potential memory leak in long-lived
Shaped::Array
instances
- Move
Shaped::Array#match_failure_reason
specs to the correct file
- Initial release of Shaped! Validate the shape of Ruby hashes and/or arrays.