Module: Formally::PredicateFinder
- Defined in:
- lib/formally/predicate_finder.rb
Constant Summary collapse
- IGNORED_METHODS =
all_method_names Object
Class Method Summary collapse
Class Method Details
.all_method_names(klass) ⇒ Object
3 4 5 |
# File 'lib/formally/predicate_finder.rb', line 3 def self.all_method_names klass (klass.instance_methods + klass.private_instance_methods).grep(/\?$/) end |
.call(klass) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/formally/predicate_finder.rb', line 9 def self.call klass predicates = [] (all_method_names(klass) - IGNORED_METHODS).each do |name| method = klass.instance_method name predicates.push method if method.arity == 0 || method.arity == 1 end Formally::Predicates.instance_methods.each do |name| predicates.push Formally::Predicates.instance_method name end predicates end |