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.
180 181 182 183 |
# File 'lib/rspec/support/method_signature_verifier.rb', line 180 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.
178 179 180 |
# File 'lib/rspec/support/method_signature_verifier.rb', line 178 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.
178 179 180 |
# File 'lib/rspec/support/method_signature_verifier.rb', line 178 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.
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
# File 'lib/rspec/support/method_signature_verifier.rb', line 191 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.
185 186 187 188 189 |
# File 'lib/rspec/support/method_signature_verifier.rb', line 185 def valid? missing_kw_args.empty? && invalid_kw_args.empty? && valid_non_kw_args? end |