Class: Safrano::FilterByParse
- Inherits:
-
FilterBase
- Object
- FilterBase
- Safrano::FilterByParse
- Defined in:
- lib/odata/collection_filter.rb
Overview
should handle everything by parsing
Constant Summary
Constants inherited from FilterBase
Safrano::FilterBase::EmptyFilter
Instance Attribute Summary collapse
-
#filterstr ⇒ Object
readonly
Returns the value of attribute filterstr.
Instance Method Summary collapse
- #apply_to_dataset(dtcx) ⇒ Object
- #empty? ⇒ Boolean
-
#finalize(jh) ⇒ Object
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.
-
#initialize(filterstr) ⇒ FilterByParse
constructor
A new instance of FilterByParse.
-
#parse_error? ⇒ Boolean
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.
Methods inherited from FilterBase
Constructor Details
Instance Attribute Details
#filterstr ⇒ Object (readonly)
Returns the value of attribute filterstr.
38 39 40 |
# File 'lib/odata/collection_filter.rb', line 38 def filterstr @filterstr end |
Instance Method Details
#apply_to_dataset(dtcx) ⇒ Object
53 54 55 56 |
# File 'lib/odata/collection_filter.rb', line 53 def apply_to_dataset(dtcx) # normally finalize is called before, and thus @filtexpr is set @filtexpr.map_result! { |f| dtcx.where(f) } end |
#empty? ⇒ Boolean
66 67 68 |
# File 'lib/odata/collection_filter.rb', line 66 def empty? false end |
#finalize(jh) ⇒ Object
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.
49 50 51 |
# File 'lib/odata/collection_filter.rb', line 49 def finalize(jh) @filtexpr = @ast.if_valid { |ast| ast.sequel_expr(jh) } end |
#parse_error? ⇒ Boolean
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
62 63 64 |
# File 'lib/odata/collection_filter.rb', line 62 def parse_error? @ast.error end |