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.
158 159 160 161 |
# File 'lib/rspec/support/method_signature_verifier.rb', line 158 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.
156 157 158 |
# File 'lib/rspec/support/method_signature_verifier.rb', line 156 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.
156 157 158 |
# File 'lib/rspec/support/method_signature_verifier.rb', line 156 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.
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/rspec/support/method_signature_verifier.rb', line 169 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.
163 164 165 166 167 |
# File 'lib/rspec/support/method_signature_verifier.rb', line 163 def valid? missing_kw_args.empty? && invalid_kw_args.empty? && valid_non_kw_args? end |