Class: Ree::Contracts::ClassValidator
Instance Attribute Summary
#contract
Instance Method Summary
collapse
#initialize
#truncate
Instance Method Details
#call(value) ⇒ Object
5
6
7
|
# File 'lib/ree/contracts/validators/class_validator.rb', line 5
def call(value)
value.is_a?(contract)
end
|
#message(value, _name, _lvl = 1) ⇒ Object
13
14
15
|
# File 'lib/ree/contracts/validators/class_validator.rb', line 13
def message(value, _name, _lvl = 1)
"expected #{contract}, got #{value.class} => #{truncate(value.inspect)}"
end
|
9
10
11
|
# File 'lib/ree/contracts/validators/class_validator.rb', line 9
def to_s
contract.name
end
|