Class: StringSatisfy::OrRule
Overview
Boolean test for ‘or’ rule, like A | B
Instance Method Summary collapse
Methods inherited from Rule
#initialize, #normal_objects, #rule_objects
Constructor Details
This class inherits a constructor from StringSatisfy::Rule
Instance Method Details
#satisfied_with?(*objects) ⇒ Boolean
29 30 31 32 33 34 |
# File 'lib/string_satisfy/rule.rb', line 29 def satisfied_with?(*objects) objects = objects.map {|object| object.gsub(/\s+/, '') }.uniq return true if normal_objects.any? {|normal_object| objects.include? normal_object } return true if rule_objects.any? {|rule_object| rule_object.satisfied_with? *objects } false end |