Sha256: 9ac919c17645e7fa34c4bdb7031747fb03481f317f7864bfcb2cd2596f90e6bc

Contents?: true

Size: 488 Bytes

Versions: 17

Compression:

Stored size: 488 Bytes

Contents

module Groupdate
  module QueryMethods
    Groupdate::PERIODS.each do |period|
      define_method :"group_by_#{period}" do |field, **options|
        Groupdate::Magic::Relation.generate_relation(self,
          period: period,
          field: field,
          **options
        )
      end
    end

    def group_by_period(period, field, permit: nil, **options)
      Groupdate::Magic.validate_period(period, permit)
      send("group_by_#{period}", field, **options)
    end
  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
groupdate-6.5.1 lib/groupdate/query_methods.rb
groupdate-6.5.0 lib/groupdate/query_methods.rb
groupdate-6.4.0 lib/groupdate/query_methods.rb
groupdate-6.3.0 lib/groupdate/query_methods.rb
groupdate-6.2.1 lib/groupdate/query_methods.rb
groupdate-6.2.0 lib/groupdate/query_methods.rb
groupdate-6.1.0 lib/groupdate/query_methods.rb
groupdate-6.0.1 lib/groupdate/query_methods.rb
groupdate-6.0.0 lib/groupdate/query_methods.rb
groupdate-5.2.4 lib/groupdate/query_methods.rb
groupdate-5.2.3 lib/groupdate/query_methods.rb
groupdate-5.2.2 lib/groupdate/query_methods.rb
groupdate-5.2.1 lib/groupdate/query_methods.rb
groupdate-5.2.0 lib/groupdate/query_methods.rb
groupdate-5.1.0 lib/groupdate/query_methods.rb
groupdate2-5.0.0 lib/groupdate/query_methods.rb
groupdate-5.0.0 lib/groupdate/query_methods.rb