Class: Ree::Contracts::DefaultValidator
Instance Attribute Summary
#contract
Instance Method Summary
collapse
#initialize
#truncate
Instance Method Details
#call(value) ⇒ Object
5
6
7
|
# File 'lib/ree/contracts/validators/default_validator.rb', line 5
def call(value)
contract == value
end
|
#message(value, _name, _lvl = 1) ⇒ Object
16
17
18
|
# File 'lib/ree/contracts/validators/default_validator.rb', line 16
def message(value, _name, _lvl = 1)
"expected #{truncate(contract.inspect, 40)}, got #{truncate(value.inspect, 40)}"
end
|
9
10
11
12
13
14
|
# File 'lib/ree/contracts/validators/default_validator.rb', line 9
def to_s
truncate(
contract.respond_to?(:to_s) ? contract.to_s : contract.inspect,
10
)
end
|