Sha256: 801dde1ede491b13b68c3a06eb229c509ada24bb41120cb70d9323bc94e4a72b
Contents?: true
Size: 521 Bytes
Versions: 4
Compression:
Stored size: 521 Bytes
Contents
# frozen_string_literal: true class QueryBuilderContext attr_reader :grouping attr_reader :current_proc def initialize(groupings = [], current_proc = nil) @grouping = groupings @current_proc = current_proc end def update(grouping, new_proc) new_grouping = @grouping + [grouping] combined_proc = combine_procs(@current_proc, new_proc) QueryBuilderContext.new(new_grouping, combined_proc) end def combine_procs(base_proc, new_proc) proc { new_proc.call(base_proc.call) } end end
Version data entries
4 entries across 4 versions & 1 rubygems