Categories: None [Edit]
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.
Total
Ranking: 171,140 of 183,139
Downloads: 2,040
Daily
Ranking: 66,923 of 183,127
Downloads: 0
Downloads Trends
Ranking Trends
Num of Versions Trends
Popular Versions (Major)
Popular Versions (Major.Minor)
Depended by
Rank | Downloads | Name |
---|
Depends on
Rank | Downloads | Name |
---|---|---|
25 | 818,346,165 | rspec |
Owners
# | Gravatar | Handle |
---|---|---|
1 | involans |