-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a Contracts::Attrs
module containing attribute w/ contracts utilities.
#255
Conversation
On a side note: thanks for making and maintaining contracts.ruby, it's an awesome project! 👌 |
a85c12d
to
14b0abc
Compare
@egonSchiele Any thoughts about dropping support for Ruby 1.8? It's been EOL and hasn't received security updates for a few years, so to me it feels like a safe decision. If you're onboard with that, I can open a new PR for that and then rebase this on top of that. |
I like this 👍 |
As per the conversation in: egonSchiele#255
PR opened: #256 |
* Drop support for Ruby 1.8. As per the conversation in: #255 * Address rubocop violation. * Mention 1.8 support drop in changelog.
can you merge master into this branch? ci should pass, and then I'll merge |
Rebased. |
Is that error related to my change here? 8e6d4ee#diff-eacde0c7f8149b55a880ae5fdcd84b3aL7 |
Looks like the issue is, methods created using
I can merge this branch and fix. |
thank you! |
More inportantly, thanks for maintaining this great library :) |
end | ||
end | ||
|
||
include Attrs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this is included in place?
Allow people to just include ::Contract & use all methods?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't remember why i added that line; feel free to remove it
## v0.16.0 - **Support for Ruby 1.8 has been discontinued** - [Corey Farwell](https://github.com/frewsxcv) [#256](egonSchiele/contracts.ruby#256) - Enhancement: Add a `Contracts::Attrs` module containing attribute w/ contracts utilities - [Corey Farwell](https://github.com/frewsxcv) [#255](egonSchiele/contracts.ruby#255) - Bugfix: Fix StrictHash contract for extra keys - [Maciej Malecki](https://github.com/smt116) [#254](egonSchiele/contracts.ruby#254) ## v0.15.0 - Bugfix: Func contract's return value isn't enforced with blocks - [Piotr Szmielew](https://github.com/esse) [#251](egonSchiele/contracts.ruby#251) - Bugfx: Fix contracts used in AR-models - [Gert Goet](https://github.com/eval) [#237](egonSchiele/contracts.ruby#237)
This pull request adds a new module
Contracts::Attrs
containing three methods to assist in using contracts with object attributes:attr_reader_with_contract <symbol>..., <contract>
attr_reader
, validates contract upon 'getting'attr_writer_with_contract <symbol>..., <contract>
attr_writer
, validates contract upon 'setting'attr_accessor_with_contract <symbol>..., <contract>
attr_accessor
, validates contract upon 'getting' or 'setting'