class Safrano::FilterByParse
should handle everything by parsing
Attributes
filterstr[R]
Public Class Methods
new(filterstr)
click to toggle source
# File lib/odata/collection_filter.rb, line 38 def initialize(filterstr) @filterstr = filterstr.dup @ast = Safrano::Filter::Parser.new(@filterstr).build end
Public Instance Methods
apply_to_dataset(dtcx)
click to toggle source
# File lib/odata/collection_filter.rb, line 51 def apply_to_dataset(dtcx) # normally finalize is called before, and thus @filtexpr is set @filtexpr.map_result! { |f| dtcx.where(f) } end
empty?()
click to toggle source
# File lib/odata/collection_filter.rb, line 64 def empty? false end
finalize(jh)
click to toggle source
this build's up the Sequel
Filter
Expression, and as a side effect, it also finalizes the join helper that we need for the start dataset join the join-helper is shared by the order-by object and was potentially already partly built on order-by object creation.
# File lib/odata/collection_filter.rb, line 47 def finalize(jh) @filtexpr = @ast.if_valid { |ast| ast.sequel_expr(jh) } end
parse_error?()
click to toggle source
Note: this is really only parse error, ie the error encounterd while trying to build the AST Later when evaluating the AST, there can be other errors, they shall be tracked with @error
# File lib/odata/collection_filter.rb, line 60 def parse_error? @ast.error end