Sha256: 4e18611614b8ed6824ae52df149ebc6d56246a475d1d2de7e88d2a7854edb77f
Contents?: true
Size: 769 Bytes
Versions: 1
Compression:
Stored size: 769 Bytes
Contents
class ContractValueObject class ErrorFormatter include Contracts Contract Symbol, Any, Any => String def contract_failure(attribute, value, contract) [ "Attribute `#{attribute}` does not conform to its contract.", "\tExpected: #{Contracts::Formatters::Expected.new(contract).contract}", "\tActual: #{value.class.name} (#{value.inspect})", ].join("\n") end Contract Symbol, Any => String def missing(attribute, contract) [ "Missing attribute `#{attribute}`.", "\tExpected: #{Contracts::Formatters::Expected.new(contract).contract}", ].join("\n") end Contract Symbol => String def unexpected(attribute) "Unexpected attribute `#{attribute}`." end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
contract_value_object-0.1.0 | lib/contract_value_object/error_formatter.rb |