active_median 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2b6d9c75498f9e09937bf9198f7b67249b2bf122
4
- data.tar.gz: 49de0d0b1f1ba1e0509cf982ed97b3abebb19cf8
3
+ metadata.gz: c745189711eba49f050c97e7248da0f6a9b2ea4f
4
+ data.tar.gz: e85bcea23ebc2c71c73f2ee4b2eef25f360d2e48
5
5
  SHA512:
6
- metadata.gz: f93d25e49d3e9e1dbb2ba51cde3f54a8233ce9fae30710c30b76edc859b02b49eb9baa33034ecf6a97fd2569111903405fc63ffc323e2034965e81f29a6ad6f0
7
- data.tar.gz: 589c9c118009bf1258aed61fcace805476549e9ca05504a0c4f21276d58e4cc97e960b4497ee3cd061d94d2a9f9d08029f114f698f55c7d5555fec6aae8290da
6
+ metadata.gz: dc818f5388d8b43ad4f73c5a0fc4f99090960f38029b842ab1b63fe34c7eeb63019f0effbc157cb93c900e4e9918939bae0b9a6e999b2dcc8927d81ffe954394
7
+ data.tar.gz: 2a80eec59464b05351a371dc07c6eb03c17baac3e6bd1358a9568cc6680677b4daa06a78ab8bc0c264d499df5bd07d84d2f2045e5cc35c72b578a6e5d95ec700
data/.gitignore CHANGED
@@ -3,7 +3,7 @@
3
3
  .bundle
4
4
  .config
5
5
  .yardoc
6
- Gemfile.lock
6
+ *.lock
7
7
  InstalledFiles
8
8
  _yardoc
9
9
  coverage
@@ -1,3 +1,7 @@
1
+ ## 0.1.2
2
+
3
+ - Added support for ActiveRecord 4.2
4
+
1
5
  ## 0.1.1
2
6
 
3
7
  - 10x faster median
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in searchkick.gemspec
4
+ gemspec path: "../"
5
+
6
+ gem "activerecord", "~> 3.2.0"
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in searchkick.gemspec
4
+ gemspec path: "../"
5
+
6
+ gem "activerecord", "~> 4.0.0"
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in searchkick.gemspec
4
+ gemspec path: "../"
5
+
6
+ gem "activerecord", "~> 4.1.0"
@@ -76,8 +76,10 @@ module Arel
76
76
  module Visitors
77
77
  class ToSql
78
78
  def visit_Arel_Nodes_Median o, a=nil
79
- if a
80
- "AVG(#{o.distinct ? 'DISTINCT ' : ''}#{o.expressions.map { |x|
79
+ if Gem::Version.new(Arel::VERSION) >= Gem::Version.new("6.0.0")
80
+ aggregate "MEDIAN", o, a
81
+ elsif a
82
+ "MEDIAN(#{o.distinct ? 'DISTINCT ' : ''}#{o.expressions.map { |x|
81
83
  visit x, a }.join(', ')})#{o.alias ? " AS #{visit o.alias, a}" : ''}"
82
84
  else
83
85
  "MEDIAN(#{o.distinct ? 'DISTINCT ' : ''}#{o.expressions.map { |x|
@@ -1,3 +1,3 @@
1
1
  module ActiveMedian
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -3,6 +3,8 @@ Bundler.require :default
3
3
  require "minitest/autorun"
4
4
  require "minitest/pride"
5
5
 
6
+ Minitest::Test = Minitest::Unit::TestCase unless defined?(Minitest::Test)
7
+
6
8
  ActiveRecord::Base.establish_connection adapter: "postgresql", database: "active_median_test"
7
9
 
8
10
  ActiveRecord::Migration.create_table :users, force: true do |t|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_median
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-13 00:00:00.000000000 Z
11
+ date: 2014-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -80,6 +80,9 @@ files:
80
80
  - README.md
81
81
  - Rakefile
82
82
  - active_median.gemspec
83
+ - gemfiles/activerecord32.gemfile
84
+ - gemfiles/activerecord40.gemfile
85
+ - gemfiles/activerecord41.gemfile
83
86
  - lib/active_median.rb
84
87
  - lib/active_median/version.rb
85
88
  - test/active_median_test.rb
@@ -111,4 +114,3 @@ summary: Median for ActiveRecord
111
114
  test_files:
112
115
  - test/active_median_test.rb
113
116
  - test/test_helper.rb
114
- has_rdoc: