Class: Contracts::KeywordArgsErrorFormatter

Inherits:
DefaultErrorFormatter show all
Defined in:
lib/contracts/error_formatter.rb

Instance Attribute Summary

Attributes inherited from DefaultErrorFormatter

#data

Instance Method Summary collapse

Methods inherited from DefaultErrorFormatter

#initialize

Constructor Details

This class inherits a constructor from Contracts::DefaultErrorFormatter

Instance Method Details

#messageObject



59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/contracts/error_formatter.rb', line 59

def message
  s = []
  s << header.to_s
  s << "        Expected: #{expected}"
  s << "        Actual: #{data[:arg].inspect}"
  s << "        Missing Contract: #{missing_contract_info}" unless missing_contract_info.empty?
  s << "        Invalid Args: #{invalid_args_info}"         unless invalid_args_info.empty?
  s << "        Missing Args: #{missing_args_info}"         unless missing_args_info.empty?
  s << "        Value guarded in: #{data[:class]}::#{method_name}"
  s << "        With Contract: #{data[:contracts]}"
  s << "        At: #{position} "

  s.join("\n")
end