metova 0.0.15 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/metova/responders/sort_responder.rb +3 -4
- data/lib/metova/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d65921ece0867769dd44e292091b13e439901f09
|
4
|
+
data.tar.gz: d09f8ec5d946a38783a0cdd4e4648dd135f6fdc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e465a29b2e268d7f0bd2535e4247646fc4ad8bd21801a688d440738692c5632827f96128498a59c9c4620e78b4bd82d3fc4b63d200797a27784594b800211665
|
7
|
+
data.tar.gz: aee087711884a9aa46f1fdbcaf7a3600a0e642182a6f73e01125423be628c61240ea030280174d1572ccdcffd64bff87db4ca86872aa5197f26e85d706ce1f2e
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module Metova
|
2
2
|
module Responders
|
3
3
|
module SortResponder
|
4
|
-
|
5
4
|
def initialize(*)
|
6
5
|
super
|
7
6
|
@resource = sort(@resource) if response_should_be_sorted?
|
@@ -9,11 +8,11 @@ module Metova
|
|
9
8
|
|
10
9
|
private
|
11
10
|
def sort(resource)
|
12
|
-
resource.
|
11
|
+
resource.reorder field_to_order_by => direction
|
13
12
|
end
|
14
13
|
|
15
14
|
def response_should_be_sorted?
|
16
|
-
controller.params.include?
|
15
|
+
controller.params.include? :sort
|
17
16
|
end
|
18
17
|
|
19
18
|
def field_to_order_by
|
@@ -21,7 +20,7 @@ module Metova
|
|
21
20
|
end
|
22
21
|
|
23
22
|
def direction
|
24
|
-
controller.params.fetch
|
23
|
+
controller.params.fetch :direction, :asc
|
25
24
|
end
|
26
25
|
end
|
27
26
|
end
|
data/lib/metova/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metova
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Logan Serman
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-01
|
12
|
+
date: 2017-03-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|