-
Notifications
You must be signed in to change notification settings - Fork 82
Fix classes that extend modules where contracts were included #198
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix classes that extend modules where contracts were included #198
Conversation
@PikachuEXE Can you verify that this branch https://github.com/waterlink/contracts.ruby/tree/fix/176/classes_with_extended_modules_with_contracts fixes the problem for you? |
53a069b
to
3864490
Compare
…'extend' to work
Hmm, this fix doesn't work with ruby 1.9.2 only. |
Ok, now it works for every ruby :) |
@waterlink |
Wait I am in #198 now |
I got another question |
Before we fully forbid usage of include Contracts::Core
include Contracts::Builtin And you will get original functionality that you have had before with |
lgtm |
…modules_with_contracts Fix classes that extend modules where contracts were included
Hope to see |
@PikachuEXE this is very simple change. Maybe you are up for making a PR? |
|
|
Fixes #176
Our current routine while including or extending
Contracts
is to defineContract(*args)
method for current class and make it just delegate toself.class.Contract
. But in case of:it doesn't work, since there is no
self.class.Contract
at this point of time. But, there is justContract
already in super class, and we may just call it. That is what this PR does: verifies if there is aContract
method in super class and calls it instead of delegating toself.class.Contract
./cc @PikachuEXE @egonSchiele