DSL and engine for segmented multi-dimensional queries with ActiveRecord-3