class Bogus::WithArguments

Attributes

predicate[R]

Public Class Methods

matches?(opts = {}) click to toggle source
# File lib/bogus/stubbing/matchers/with_arguments.rb, line 13
def self.matches?(opts = {})
  stubbed = opts.fetch(:stubbed)
  recorded = opts.fetch(:recorded)
  return false unless with_matcher?(stubbed)
  return extract(stubbed).matches?(recorded)
end
new(&predicate) click to toggle source
# File lib/bogus/stubbing/matchers/with_arguments.rb, line 5
def initialize(&predicate)
  @predicate = predicate
end
with_matcher?(args) click to toggle source
# File lib/bogus/stubbing/matchers/with_arguments.rb, line 20
def self.with_matcher?(args)
  args.first.is_a?(WithArguments)
end

Private Class Methods

extract(args) click to toggle source
# File lib/bogus/stubbing/matchers/with_arguments.rb, line 26
def self.extract(args)
  args.first
end

Public Instance Methods

matches?(args) click to toggle source
# File lib/bogus/stubbing/matchers/with_arguments.rb, line 9
def matches?(args)
  predicate.call(*args)
end