Sha256: b1a11a5622c4adc86ff94439bff0de1e02ea417bd721a233f1177e2dd3f90396

Contents?: true

Size: 418 Bytes

Versions: 4

Compression:

Stored size: 418 Bytes

Contents

module Groupdate
  module Scopes

    Groupdate::FIELDS.each do |field|
      define_method :"group_by_#{field}" do |*args|
        args = args.dup
        options = args[-1].is_a?(Hash) ? args.pop : {}
        options[:time_zone] ||= args[1] unless args[1].nil?
        options[:range] ||= args[2] unless args[2].nil?

        Groupdate::Magic.new(field, options).relation(args[0], self)
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
groupdate-2.4.0 lib/groupdate/scopes.rb
groupdate-2.3.0 lib/groupdate/scopes.rb
groupdate-2.2.1 lib/groupdate/scopes.rb
groupdate-2.2.0 lib/groupdate/scopes.rb