Project
deconstructable
This gem provides Deconstructable, a mixin module that helps you to support
pattern-matching over your types.
Usage
--------
```
class Thing
include Deconstructable
...
deconstructable :x, :y
deconstructable def foo
do_the_foo
end
end
```
This class provides a single DSL method `deconstructable` which helps you to mark
methods and attributes as deconstructable. Deconstructable attributes will be made
available in pattern matching, e.g.:
```
thing in Thing(foo:, x: 100, y:)
```
Classes that include `Deconstructable` gain an implementation of `deconstruct_keys` that permits
hash-style key based pattern matching. Positional array-style patterns are not supported.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
Development
Licenses
MIT
Dependencies
Development
~> 3.2