Class: Ree::Contracts::ArgContracts::RespondTo
- Extended by:
- Squarable
- Defined in:
- lib/ree/contracts/arg_contracts/respond_to.rb
Instance Method Summary collapse
-
#initialize(*method_names) ⇒ RespondTo
constructor
A new instance of RespondTo.
- #message(value, name, lvl = 1) ⇒ Object
- #to_s ⇒ Object
- #valid?(value) ⇒ Boolean
Methods included from Squarable
Constructor Details
#initialize(*method_names) ⇒ RespondTo
Returns a new instance of RespondTo.
8 9 10 |
# File 'lib/ree/contracts/arg_contracts/respond_to.rb', line 8 def initialize(*method_names) @method_names = method_names end |
Instance Method Details
#message(value, name, lvl = 1) ⇒ Object
20 21 22 23 |
# File 'lib/ree/contracts/arg_contracts/respond_to.rb', line 20 def (value, name, lvl = 1) unrespond_list = get_unrespond_list(value) "expected to respond to #{unrespond_list.inspect}}" end |
#to_s ⇒ Object
16 17 18 |
# File 'lib/ree/contracts/arg_contracts/respond_to.rb', line 16 def to_s "RespondTo#{method_names.inspect}" end |
#valid?(value) ⇒ Boolean
12 13 14 |
# File 'lib/ree/contracts/arg_contracts/respond_to.rb', line 12 def valid?(value) get_unrespond_list(value).empty? end |