Class: SqlTools::PredicateFilter
- Inherits:
-
Object
- Object
- SqlTools::PredicateFilter
- Defined in:
- lib/sql_tools/predicate_filter.rb
Instance Method Summary collapse
- #filter(object) ⇒ Object
-
#initialize(query) ⇒ PredicateFilter
constructor
A new instance of PredicateFilter.
Constructor Details
#initialize(query) ⇒ PredicateFilter
Returns a new instance of PredicateFilter.
3 4 5 |
# File 'lib/sql_tools/predicate_filter.rb', line 3 def initialize(query) @query = query end |
Instance Method Details
#filter(object) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/sql_tools/predicate_filter.rb', line 7 def filter(object) @stack = [] filter_recursive(object, @query.predicate) right = @stack.pop while left = @stack.pop predicate = Predicate::Binary.new(left, "AND", right) right = predicate end right end |