Parent

Files

Class/Module Index [+]

Quicksearch

BeComputedByFunctionMatcher

Public Class Methods

new(sym, *args) click to toggle source
# File lib/mspec/matchers/be_computed_by_function.rb, line 2
def initialize(sym, *args)
  @function = sym
  @args = args
end

Public Instance Methods

failure_message() click to toggle source
# File lib/mspec/matchers/be_computed_by_function.rb, line 26
def failure_message
  ["Expected #{@value.inspect}", "to be computed by #{function_call}"]
end
function_call() click to toggle source
# File lib/mspec/matchers/be_computed_by_function.rb, line 18
def function_call
  function_call = "#{@function}"
  unless @arguments.empty?
    function_call << "(#{@arguments.map { |x| x.inspect }.join(", ")})"
  end
  function_call
end
matches?(array) click to toggle source
# File lib/mspec/matchers/be_computed_by_function.rb, line 7
def matches?(array)
  array.each do |line|
    @value = line.pop
    @arguments = line
    @arguments += @args
    return false unless send(@function, *@arguments) == @value
  end

  return true
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.