lib/appfuel/domain/search_criteria.rb in appfuel-0.2.4 vs lib/appfuel/domain/search_criteria.rb in appfuel-0.2.5

- old
+ new

@@ -35,11 +35,11 @@ # error_on_empty # parser # transform # class SearchCriteria < BaseCriteria - + attr_reader :order_exprs # Parse out the domain into feature, domain, determine the name of the # repo this criteria is for and initailize basic settings. # global.user # # membership.user @@ -66,11 +66,11 @@ # @param opts [Hash] options for initializing criteria # @return [Criteria] def initialize(domain_name, data = {}) super @limit = nil - @order = [] + @order_exprs = [] filter(data[:filter]) if data[:filter] end def filter(str, op: 'and') expr = parse_expr(str) @@ -79,11 +79,11 @@ expr = qualify_expr(expr) if filters? expr = ExprConjunction.new(op, filters, expr) end - @filters = filter + @filters = expr self end def limit(nbr = nil) return @limit if nbr.nil? @@ -118,10 +118,10 @@ dir, domain_attr = item.first dir = dir.to_s.downcase unless ['desc', 'asc'].include(dir) fail "order array item must have a hash key of desc or asc" end - @order << {dir => domain_attr} + @order_exprs << {dir => domain_attr} end self end private