Module: RSpec::Matcher::PrependedMethods Private

Defined in:
lib/rspec/matcher.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Used to let user define initialize

Instance Method Summary collapse

Instance Method Details

#initialize(expected = UNDEFINED, options = {}, *args, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Stores expected and options then passes remaining args to super

Parameters:

  • expected (any) (defaults to: UNDEFINED)

    stored as expected and not passed to custom initializer

  • options (Hash) (defaults to: {})

    stored by calling setter methods

  • args... (any)

    passed to custom initializer

  • block (Proc)

    passed to custom initializer



94
95
96
97
98
99
100
101
# File 'lib/rspec/matcher.rb', line 94

def initialize expected = UNDEFINED, options = {}, *args, &block
  self.expected = expected
  options.to_a.each do |option|
    key, value = option
    send("#{key}=", value)
  end
  super(*args, &block)
end