Method: Graphiti::Query#stats

Defined in:
lib/graphiti/query.rb

#statsObject



209
210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/graphiti/query.rb', line 209

def stats
  @stats ||= begin
    {}.tap do |hash|
      (@params[:stats] || {}).each_pair do |k, v|
        if legacy_nested?(k)
          raise NotImplementedError.new("Association statistics are not currently supported")
        elsif top_level?
          v = v.split(",") if v.is_a?(String)
          hash[k.to_sym] = Array(v).flatten.map(&:to_sym)
        end
      end
    end
  end
end