Class: RSpec::Support::MethodSignatureVerifier Private
- Inherits:
-
Object
- Object
- RSpec::Support::MethodSignatureVerifier
- 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.
Abstract base class for signature verifiers.
Direct Known Subclasses
Instance Attribute Summary collapse
- #kw_args ⇒ Object readonly private
- #non_kw_args ⇒ Object readonly private
Instance Method Summary collapse
- #error_message ⇒ Object private
-
#initialize(signature, args) ⇒ MethodSignatureVerifier
constructor
private
A new instance of MethodSignatureVerifier.
- #valid? ⇒ Boolean private
Constructor Details
#initialize(signature, args) ⇒ MethodSignatureVerifier
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.
Returns a new instance of MethodSignatureVerifier.
162 163 164 165 |
# File 'lib/rspec/support/method_signature_verifier.rb', line 162 def initialize(signature, args) @signature = signature @non_kw_args, @kw_args = split_args(*args) end |
Instance Attribute Details
#kw_args ⇒ Object (readonly)
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.
160 161 162 |
# File 'lib/rspec/support/method_signature_verifier.rb', line 160 def kw_args @kw_args end |
#non_kw_args ⇒ Object (readonly)
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.
160 161 162 |
# File 'lib/rspec/support/method_signature_verifier.rb', line 160 def non_kw_args @non_kw_args end |
Instance Method Details
#error_message ⇒ 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.
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/rspec/support/method_signature_verifier.rb', line 173 def if missing_kw_args.any? "Missing required keyword arguments: %s" % [ missing_kw_args.join(", ") ] elsif invalid_kw_args.any? "Invalid keyword arguments provided: %s" % [ invalid_kw_args.join(", ") ] elsif !valid_non_kw_args? "Wrong number of arguments. Expected %s, got %s." % [ @signature.non_kw_args_arity_description, non_kw_args.length ] end end |
#valid? ⇒ Boolean
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.
167 168 169 170 171 |
# File 'lib/rspec/support/method_signature_verifier.rb', line 167 def valid? missing_kw_args.empty? && invalid_kw_args.empty? && valid_non_kw_args? end |