Class: RSpec::Support::BlockSignature Private

Inherits:
MethodSignature show all
Defined in:
lib/rspec/support/method_signature_verifier.rb

Overview

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

Deals with the slightly different semantics of block arguments. For methods, arguments are required unless a default value is provided. For blocks, arguments are optional, even if no default value is provided.

However, we want to treat block args as required since you virtually always want to pass a value for each received argument and our ‘and_yield` has treated block args as required for many years.

Constant Summary

Constants inherited from MethodSignature

MethodSignature::INFINITY

Instance Attribute Summary

Attributes inherited from MethodSignature

#max_non_kw_args, #min_non_kw_args, #optional_kw_args, #required_kw_args

Instance Method Summary collapse

Methods inherited from MethodSignature

#arbitrary_kw_args?, #classify_arity, #could_contain_kw_args?, #description, #has_kw_args_in?, #initialize, #invalid_kw_args_from, #missing_kw_args_from, #non_kw_args_arity_description, #unlimited_args?, #valid_non_kw_args?

Constructor Details

This class inherits a constructor from RSpec::Support::MethodSignature

Instance Method Details

#classify_parametersObject

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.



263
264
265
266
# File 'lib/rspec/support/method_signature_verifier.rb', line 263

def classify_parameters
  super
  @min_non_kw_args = @max_non_kw_args unless @max_non_kw_args == INFINITY
end