Class: AffirmIt::Preference::RespondsTo
- Inherits:
-
Preference
- Object
- Preference
- AffirmIt::Preference::RespondsTo
- Defined in:
- lib/affirmit/preference/respondsto.rb
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(expected) ⇒ RespondsTo
constructor
A new instance of RespondsTo.
- #is_preferred?(actual) ⇒ Boolean
Methods inherited from Preference
Constructor Details
#initialize(expected) ⇒ RespondsTo
Returns a new instance of RespondsTo.
6 7 8 |
# File 'lib/affirmit/preference/respondsto.rb', line 6 def initialize expected @expected = expected end |
Instance Method Details
#description ⇒ Object
14 15 16 |
# File 'lib/affirmit/preference/respondsto.rb', line 14 def description return "an object that responds to <#{@expected.inspect}>" end |
#is_preferred?(actual) ⇒ Boolean
10 11 12 |
# File 'lib/affirmit/preference/respondsto.rb', line 10 def is_preferred? actual actual.respond_to? @expected end |