Module: AhoyCaptain::ComparableQueries

Included in:
LazyComparableQuery::LazyComparison
Defined in:
app/queries/concerns/ahoy_captain/comparable_queries.rb

Instance Method Summary collapse

Instance Method Details

#compare_rangeObject



3
4
5
6
7
# File 'app/queries/concerns/ahoy_captain/comparable_queries.rb', line 3

def compare_range
  @compare_range ||= begin
                       ComparisonMode.new(@params).compared_to_range
                     end
end

#comparison_paramsObject



13
14
15
16
17
18
19
20
# File 'app/queries/concerns/ahoy_captain/comparable_queries.rb', line 13

def comparison_params
  params = @params.deep_dup
  params.delete("period")

  params[:start_date] = compare_range[0]
  params[:end_date] = compare_range[1]
  params
end

#rangeObject



9
10
11
# File 'app/queries/concerns/ahoy_captain/comparable_queries.rb', line 9

def range
  @range ||= @query.send(:range)
end