4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/callme/contract_validator.rb', line 4
def validate(dependency_class, contract_class, const_loader)
contract_class = const_loader.load_const(contract_class) if contract_class.is_a?(String)
contract_methods = (contract_class.instance_methods - Object.instance_methods)
dependency_methods = (dependency_class.instance_methods - Object.instance_methods)
missing_methods = contract_methods - dependency_methods
if !missing_methods.empty?
raise Callme::Errors::DependencyContractMissingMethodsException.new({
dep: dependency_class,
contract: contract_class,
missing: missing_methods
})
end
validate_methods(dependency_class, contract_class, contract_methods)
end
|