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 +4 -4
- data/.gitignore +1 -1
- data/CHANGELOG.md +4 -0
- data/gemfiles/activerecord32.gemfile +6 -0
- data/gemfiles/activerecord40.gemfile +6 -0
- data/gemfiles/activerecord41.gemfile +6 -0
- data/lib/active_median.rb +4 -2
- data/lib/active_median/version.rb +1 -1
- data/test/test_helper.rb +2 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c745189711eba49f050c97e7248da0f6a9b2ea4f
|
4
|
+
data.tar.gz: e85bcea23ebc2c71c73f2ee4b2eef25f360d2e48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc818f5388d8b43ad4f73c5a0fc4f99090960f38029b842ab1b63fe34c7eeb63019f0effbc157cb93c900e4e9918939bae0b9a6e999b2dcc8927d81ffe954394
|
7
|
+
data.tar.gz: 2a80eec59464b05351a371dc07c6eb03c17baac3e6bd1358a9568cc6680677b4daa06a78ab8bc0c264d499df5bd07d84d2f2045e5cc35c72b578a6e5d95ec700
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/lib/active_median.rb
CHANGED
@@ -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
|
80
|
-
"
|
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|
|
data/test/test_helper.rb
CHANGED
@@ -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.
|
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-
|
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:
|