Class: Peeky::Predicates::AttrWriterPredicate
- Inherits:
-
Object
- Object
- Peeky::Predicates::AttrWriterPredicate
- Defined in:
- lib/peeky/predicates/attr_writer_predicate.rb
Overview
Attr Writer Predicate will match true if the method info could be considered a valid attr_writer
Instance Method Summary collapse
-
#match(instance, method_info) ⇒ Object
Match will return true if the method_info seems to be an :attr_writer.
Instance Method Details
#match(instance, method_info) ⇒ Object
Match will return true if the method_info seems to be an :attr_writer
14 15 16 17 18 19 20 21 22 |
# File 'lib/peeky/predicates/attr_writer_predicate.rb', line 14 def match(instance, method_info) return false unless prerequisites(instance, method_info) param = method_info.parameters.first # Taking advantage of an odd reflection concept in ruby where by # method.parameters returns this array value [:req] for :attr_writer # while ordinary methods return [:req, some_param_name] param.type == :param_required && param.name.empty? end |