Class: ArgumentSpecification::Matchers::RespondTo
- Inherits:
-
BaseMatcher
- Object
- BaseMatcher
- ArgumentSpecification::Matchers::RespondTo
- Defined in:
- lib/argspec/matchers/respond_to.rb
Instance Attribute Summary collapse
-
#expected ⇒ Object
readonly
Returns the value of attribute expected.
Attributes inherited from BaseMatcher
Instance Method Summary collapse
-
#initialize(expected) ⇒ RespondTo
constructor
Create a new matcher instance.
-
#matches? ⇒ Boolean
Check if the actual object matches.
Methods inherited from BaseMatcher
#failure_message, #failure_message_when_negated, matcher_name
Constructor Details
#initialize(expected) ⇒ RespondTo
Create a new matcher instance
Arguments:
expected: (Symbol)
Example:
>> ArgumentSpecification::Matchers::RespondTo.new(:hello)
=> #<ArgumentSpecification::Matchers::RespondTo:0x00000000000000 @expected=:hello>
17 18 19 |
# File 'lib/argspec/matchers/respond_to.rb', line 17 def initialize(expected) @expected = expected end |
Instance Attribute Details
#expected ⇒ Object (readonly)
Returns the value of attribute expected.
6 7 8 |
# File 'lib/argspec/matchers/respond_to.rb', line 6 def expected @expected end |
Instance Method Details
#matches? ⇒ Boolean
Check if the actual object matches
Example:
>> matcher.matches?
=> true
27 28 29 |
# File 'lib/argspec/matchers/respond_to.rb', line 27 def matches? @actual.respond_to?(@expected) end |