mincer 0.2.4 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mincer/processors/sorting/processor.rb +8 -8
- data/lib/mincer/version.rb +1 -1
- data/mincer.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b5c443e2818115e62416949527c18a14b8af182
|
4
|
+
data.tar.gz: 10906282d26a6690af1655e20e9975446cbf1610
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38952e626c0e84e6708aeceebd9d2f5711286df3b508a5fd7f8a7fc05e774f7d1c7ecbd11de0a7e818857dd87c68ec5e226b7be7a2206112f5b2599a7cedc1b7
|
7
|
+
data.tar.gz: 9004f37a50fb8a18e3c55ebe8ed39e2bcf846e916f331398723cd5e3453a6f18d7f1273a9d8545149120afab80e5dfa68b28523894fe7e0b8b127915ebbe9843
|
@@ -7,17 +7,17 @@ module Mincer
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def apply
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
sorting_sting = sort_string
|
11
|
+
if sorting_sting.present?
|
12
|
+
@mincer.sort_attribute, @mincer.sort_order = sort_attr.to_s, order_attr.to_s
|
13
|
+
@relation.order(sorting_sting)
|
14
|
+
else
|
15
|
+
@relation
|
16
|
+
end
|
13
17
|
end
|
14
18
|
|
15
19
|
def sort_string
|
16
|
-
|
17
|
-
"#{sort_attr} #{order_attr || default_order}"
|
18
|
-
else
|
19
|
-
"#{default_sort} #{order_attr || default_order}"
|
20
|
-
end
|
20
|
+
[(sort_attr || default_sort), (order_attr || default_order)].compact.uniq.join(' ')
|
21
21
|
end
|
22
22
|
|
23
23
|
def sort_attr
|
data/lib/mincer/version.rb
CHANGED
data/mincer.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_dependency 'activerecord', '
|
21
|
+
spec.add_dependency 'activerecord', '~> 4.2'
|
22
22
|
|
23
23
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
24
24
|
spec.add_development_dependency 'rake'
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mincer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Krasinsky
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '4.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '4.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
@@ -196,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
196
|
version: '0'
|
197
197
|
requirements: []
|
198
198
|
rubyforge_project:
|
199
|
-
rubygems_version: 2.
|
199
|
+
rubygems_version: 2.4.3
|
200
200
|
signing_key:
|
201
201
|
specification_version: 4
|
202
202
|
summary: ActiveRecord::Relation wrapper for pagination, order, json, search, cache_digest
|