module Contractinator::ContractHelpers::Shared

Public Instance Methods

contract_message_signature(dbl, msg, args, value) click to toggle source
# File lib/contractinator/contract_helpers.rb, line 59
def contract_message_signature(dbl, msg, args, value)
  if args.try(:any?)
    "#{fmt_dbl dbl}.#{msg}(#{fmt_args args}) -> #{fmt_args value}"
  else
    "#{fmt_dbl dbl}.#{msg} -> #{fmt_args value}"
  end
end
customization(matcher, named) click to toggle source
# File lib/contractinator/contract_helpers.rb, line 77
def customization(matcher, named)
  matcher.
    instance_variable_get('@recorded_customizations').
    find do |x|
      x.instance_variable_get('@method_name').to_s == named.to_s
    end.try(:instance_variable_get, '@args')
end
fmt_args(args) click to toggle source
# File lib/contractinator/contract_helpers.rb, line 71
def fmt_args(args)
  args.map do |x|
    fmt_dbl(x)
  end.join(',  ')
end
fmt_dbl(*args) click to toggle source
# File lib/contractinator/contract_helpers.rb, line 67
def fmt_dbl(*args)
  @context.fmt_dbl(*args)
end