Module: NoyesFilterDSL

Overview

This portion is still highly experimental. It allows filters to be combined in complicated ways using a syntax similar to Backus Naur Form.

Defined Under Namespace

Classes: ParallelFilter, SerialFilter

Instance Method Summary collapse

Instance Method Details

#+(other) ⇒ Object

Combines two filters into a single serial filter. That is A + B results in a filter S such that filtering through S is the identical to filtering through A and then B.



15
16
17
18
# File 'lib/common/noyes_dsl.rb', line 15

def + other
  other_filters = other.kind_of?(SerialFilter) ? other.filters.clone : other
  SerialFilter.new [self, other].flatten
end

#|(other) ⇒ Object

Combines two filters into a single parallel filter. That is A | B creates a new filter P such that filtering through P is identical to filtering row 0 of an array through filter A and row 1 of an array through filter B. Typically P would be used with an array of arrays. This filter can be used with more than two filters.



25
26
27
28
# File 'lib/common/noyes_dsl.rb', line 25

def | other
   other_filters = other.kind_of?(ParallelFilter) ? other.filtes.clone : other
   ParallelFilter.new [self, other].flatten
end