mincer 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: e760eb485129e914fb5ac87ab37ded1217ba6114
4
- data.tar.gz: 99cba1c3544b4b7f294ceeb9f0fe25535e9943a1
3
+ metadata.gz: 5e7dd6365cd2d30f20a4595d0c5200254069203c
4
+ data.tar.gz: d0ed94870519e2b8942ada6e8a832d036b4ab94e
5
5
  SHA512:
6
- metadata.gz: 09778cda72e7c9fb49542418647e8610c787a0ec5c79176773accc5a89d92593347c6347a76fe518aff83c1f432b78a29ef3b2ee5d14e464476fe61c0dfd0851
7
- data.tar.gz: b77528eea0f446b5f832a44696c32f74777c375512210ad6412e9173017a746672ec881a905ca68b196c0d78e8cc9f92f510dc91ce2eb6b9a5add5cfe789493a
6
+ metadata.gz: 64bdc85e7bfb0fb9f5be0cbd9e151c9da26360d3fdd01024ba5a7fcd9fcba320def5fa53ee171b6bac818ef3b50668664fc1631589fbb38a0577743b7d70cfb4
7
+ data.tar.gz: eee05868aa5857630101de2a085dcaf5275390b2a248c3ea5fe50c1226458cd8c5e932637f975c7add37f468a57ef3f427f67a7cbeacee3a59274b010507fb20
@@ -11,9 +11,9 @@ module Mincer
11
11
 
12
12
  def opposite_order_for(collection, attribute)
13
13
  return nil unless collection.sort_attribute == attribute.to_s
14
- if collection.sort_order.to_s.upcase == 'ASC'
14
+ if collection.sort_order.to_s.downcase == 'asc'
15
15
  'DESC'
16
- elsif collection.sort_order.to_s.upcase == 'DESC'
16
+ elsif collection.sort_order.to_s.downcase == 'desc'
17
17
  'ASC'
18
18
  else
19
19
  'ASC'
@@ -8,20 +8,20 @@ module Mincer
8
8
 
9
9
  def apply
10
10
  relation = @relation.order(sort_string)
11
- @mincer.sort_attribute, @mincer.sort_order = relation.try(:order_values).try(:first).try(:split)
11
+ @mincer.sort_attribute, @mincer.sort_order = sort_attr, order_attr
12
12
  relation
13
13
  end
14
14
 
15
15
  def sort_string
16
- sort_attr ? "#{sort_attr} #{order_attr}, #{@mincer.default_sort_attribute}" : "#{@mincer.default_sort_attribute} #{order_attr}"
16
+ sort_attr ? "#{sort_attr} #{order_attr}, #{@mincer.send(:default_sort_attribute)}" : "#{@mincer.send(:default_sort_attribute)} #{order_attr}"
17
17
  end
18
18
 
19
19
  def sort_attr
20
- @mincer.allowed_sort_attributes.include?(@args['sort']) && @args['sort']
20
+ @mincer.send(:allowed_sort_attributes).include?(@args['sort']) && @args['sort']
21
21
  end
22
22
 
23
23
  def order_attr
24
- (%w{ASC DESC}.include?(@args['order']) && @args['order']) || @mincer.default_sort_order
24
+ (%w{ASC DESC}.include?(@args['order']) && @args['order']) || @mincer.send(:default_sort_order)
25
25
  end
26
26
  end
27
27
 
@@ -1,7 +1,7 @@
1
1
  module Mincer
2
2
 
3
3
  def self.version
4
- Gem::Version.new '0.1.1'
4
+ Gem::Version.new '0.1.2'
5
5
  end
6
6
 
7
7
  module VERSION #:nodoc:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mincer
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
  - Alex Krasinsky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-09 00:00:00.000000000 Z
11
+ date: 2014-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord