Module: RiderServer::Validate::PredicateLogic
- Included in:
- Base
- Defined in:
- lib/rider_server/validate/predicates.rb
Instance Method Summary collapse
Instance Method Details
#add_predicate(&block) ⇒ Object
13 14 15 16 |
# File 'lib/rider_server/validate/predicates.rb', line 13 def add_predicate(&block) @predicates ||= [] @predicates << block end |
#check_predicates(data) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rider_server/validate/predicates.rb', line 18 def check_predicates(data) return [true, ""] if @predicates.nil? @predicates.each do |predicate| result, reason = predicate.call(data) unless result return [result, reason] end end [true, ""] end |