diff --git a/lib/contracts.rb b/lib/contracts.rb index 2e6e9ea..3e1bfc4 100644 --- a/lib/contracts.rb +++ b/lib/contracts.rb @@ -111,7 +111,7 @@ def to_s ("#{args} => #{ret}").gsub("Contracts::Builtin::", "") end - # Given a hash, prints out a failure message. + # Given a hash, returns a failure message. # This function is used by the default #failure_callback method # and uses the hash passed into the failure_callback method. def self.failure_msg(data) @@ -130,6 +130,7 @@ def self.failure_msg(data) Actual: #{data[:arg].inspect} Value guarded in: #{data[:class]}::#{method_name} With Contract: #{data[:contracts]} + All arguments: #{data[:args].inspect} At: #{position} } end diff --git a/lib/contracts/call_with.rb b/lib/contracts/call_with.rb index 29a609f..ae28857 100644 --- a/lib/contracts/call_with.rb +++ b/lib/contracts/call_with.rb @@ -23,6 +23,7 @@ def call_with(this, *args, &blk) :contracts => self, :arg_pos => i+1, :total_args => args.size, + :args => args, :return_value => false) end @@ -56,6 +57,7 @@ def call_with(this, *args, &blk) :contracts => self, :arg_pos => i-1, :total_args => args.size, + :args => args, :return_value => false) end @@ -82,6 +84,7 @@ def call_with(this, *args, &blk) :class => klass, :method => method, :contracts => self, + :args => args, :return_value => true) end