Class: RSpec::SleepingKingStudios::Support::MethodSignatureExpectation Private
- Inherits:
-
Object
- Object
- RSpec::SleepingKingStudios::Support::MethodSignatureExpectation
- Defined in:
- lib/rspec/sleeping_king_studios/support/method_signature_expectation.rb
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.
Instance Attribute Summary collapse
- #any_keywords ⇒ Object writeonly private
- #block_argument ⇒ Object writeonly private
- #errors ⇒ Object readonly private
-
#keywords ⇒ Object
private
method initialize.
-
#max_arguments ⇒ Object
private
method initialize.
-
#min_arguments ⇒ Object
private
method initialize.
- #unlimited_arguments ⇒ Object writeonly private
Instance Method Summary collapse
-
#any_keywords? ⇒ Boolean
private
method matches?.
-
#block_argument? ⇒ Boolean
private
method any_keywords?.
- #description ⇒ Object private
-
#initialize ⇒ MethodSignatureExpectation
constructor
private
A new instance of MethodSignatureExpectation.
-
#matches?(method) ⇒ Boolean
private
method description.
-
#unlimited_arguments? ⇒ Boolean
private
method block_argument?.
Constructor Details
#initialize ⇒ MethodSignatureExpectation
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 MethodSignatureExpectation.
10 11 12 13 14 15 16 17 18 |
# File 'lib/rspec/sleeping_king_studios/support/method_signature_expectation.rb', line 10 def initialize @min_arguments = 0 @max_arguments = 0 @unlimited_arguments = false @keywords = [] @any_keywords = false @block_argument = false @errors = {} end |
Instance Attribute Details
#any_keywords=(value) ⇒ Object (writeonly)
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.
22 23 24 |
# File 'lib/rspec/sleeping_king_studios/support/method_signature_expectation.rb', line 22 def any_keywords=(value) @any_keywords = value end |
#block_argument=(value) ⇒ Object (writeonly)
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.
22 23 24 |
# File 'lib/rspec/sleeping_king_studios/support/method_signature_expectation.rb', line 22 def block_argument=(value) @block_argument = value end |
#errors ⇒ 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.
24 25 26 |
# File 'lib/rspec/sleeping_king_studios/support/method_signature_expectation.rb', line 24 def errors @errors end |
#keywords ⇒ 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.
method initialize
20 21 22 |
# File 'lib/rspec/sleeping_king_studios/support/method_signature_expectation.rb', line 20 def keywords @keywords end |
#max_arguments ⇒ 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.
method initialize
20 21 22 |
# File 'lib/rspec/sleeping_king_studios/support/method_signature_expectation.rb', line 20 def max_arguments @max_arguments end |
#min_arguments ⇒ 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.
method initialize
20 21 22 |
# File 'lib/rspec/sleeping_king_studios/support/method_signature_expectation.rb', line 20 def min_arguments @min_arguments end |
#unlimited_arguments=(value) ⇒ Object (writeonly)
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.
22 23 24 |
# File 'lib/rspec/sleeping_king_studios/support/method_signature_expectation.rb', line 22 def unlimited_arguments=(value) @unlimited_arguments = value end |
Instance Method Details
#any_keywords? ⇒ 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.
method matches?
60 61 62 |
# File 'lib/rspec/sleeping_king_studios/support/method_signature_expectation.rb', line 60 def any_keywords? !!@any_keywords end |
#block_argument? ⇒ 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.
method any_keywords?
64 65 66 |
# File 'lib/rspec/sleeping_king_studios/support/method_signature_expectation.rb', line 64 def block_argument? !!@block_argument end |
#description ⇒ 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.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/rspec/sleeping_king_studios/support/method_signature_expectation.rb', line 26 def description = [] if min_arguments == max_arguments << "#{min_arguments} argument#{1 == min_arguments ? '' : 's'}" else << "#{min_arguments}..#{max_arguments} arguments" end # if-else << 'unlimited arguments' if unlimited_arguments? unless keywords.empty? keywords_list = array_tools.humanize_list keywords.map(&:inspect) << "keyword#{1 == keywords.count ? '' : 's'} #{keywords_list}" end # if << 'arbitrary keywords' if any_keywords? << 'a block' if block_argument? "with #{array_tools.humanize_list }" end |
#matches?(method) ⇒ 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.
method description
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/rspec/sleeping_king_studios/support/method_signature_expectation.rb', line 49 def matches? method @signature = MethodSignature.new(method) @errors = {} match = true match = false unless matches_arity? match = false unless matches_keywords? match = false unless matches_block? match end |
#unlimited_arguments? ⇒ 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.
method block_argument?
68 69 70 |
# File 'lib/rspec/sleeping_king_studios/support/method_signature_expectation.rb', line 68 def unlimited_arguments? !!@unlimited_arguments end |