Module: Pdfrb::Arlington::Predicate::Functions::LogicalPredicates
- Defined in:
- lib/pdfrb/arlington/predicate/functions/logical.rb
Overview
Logical predicates that don't fit Ruby's native && / || / ! dispatch: Eval (run a sub-expression), Not (alias for !).
Class Method Summary collapse
Class Method Details
.register_all ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/pdfrb/arlington/predicate/functions/logical.rb', line 12 def register_all Functions.register("Eval") do |args, _ctx| # Eval is special: its single argument is already # evaluated by the time we get it (because the Evaluator # walks args eagerly). So we just return the value as-is. args.first end Functions.register("Not") do |args, _ctx| !args.first end Functions.register("And") do |args, _ctx| args.all? { |a| a } end Functions.register("Or") do |args, _ctx| args.any? { |a| a } end end |