Last active
February 26, 2016 10:23
-
-
Save naps62/7ee35e53635e1b7ee9ae to your computer and use it in GitHub Desktop.
egonSchiele/contracts.ruby - issue #229
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "contracts" | |
C = Contracts | |
module ModuleWithContracts | |
def self.included(base) | |
base.extend ClassMethods | |
end | |
module ClassMethods | |
include Contracts::Core | |
Contract C::None => String | |
def foo | |
"bar" | |
end | |
end | |
end | |
# this class works | |
class ContractsThenModule | |
include Contracts::Core | |
include ModuleWithContracts | |
Contract C::Num => C::Num | |
def double(x) | |
x * 2 | |
end | |
end | |
# but this one, with the module included before the contracts, fails to compile | |
class ModuleThenContracts | |
include ModuleWithContracts | |
include Contracts::Core | |
# fails on this line | |
Contract C::Num => C::Num | |
def double(x) | |
x * 2 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment