sortify 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/README.md +3 -3
- data/lib/sortify/version.rb +1 -1
- data/lib/sortify.rb +3 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60aacb876a73fc6b01d0ae3e7806a79f2408994e
|
4
|
+
data.tar.gz: 309bd3fbe11408c9944aeb9461c1f76c2db816ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7353b80842ba1cb33383e5e69a6034818a9a9714700e0a840d6996cee9bd84d610c39d8064456fef245680d2e86e0148fadcc9b039889bfb0e249734696560d
|
7
|
+
data.tar.gz: ca67f51574dde755b7f50f0c8b78967dc306929e5aa70657a9d19ca86cb7b1b5047c9c6867b2626ac2f4f27bf39169c5a06adcf937bb1adce1e5d4b1e8248643
|
data/README.md
CHANGED
@@ -8,15 +8,15 @@
|
|
8
8
|
Sortify helps you handle user-provided sort options in Rails apps.
|
9
9
|
|
10
10
|
> #### :warning: **Warning**:
|
11
|
-
> Sortify is in the very early stages of development right now, has
|
11
|
+
> Sortify is in the very early stages of development right now, has few tests and could introduce breaking changes. Use at your own risk.
|
12
12
|
|
13
13
|
## Getting Started
|
14
14
|
|
15
15
|
To get started, add sortify to your gemfile:
|
16
16
|
|
17
|
-
`gem 'sortify'
|
17
|
+
`gem 'sortify'`
|
18
18
|
|
19
|
-
|
19
|
+
Then run `bundle install` to fetch the current version.
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
data/lib/sortify/version.rb
CHANGED
data/lib/sortify.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Sortify
|
2
2
|
def sort_option(name, body)
|
3
3
|
@sort_options ||= []
|
4
|
-
name = name.to_sym
|
4
|
+
name = name.to_sym
|
5
5
|
|
6
6
|
begin
|
7
7
|
scope name, body
|
@@ -20,8 +20,8 @@ module Sortify
|
|
20
20
|
return @sort_options
|
21
21
|
end
|
22
22
|
|
23
|
-
def sortify(sort_option)
|
24
|
-
sort_option = sort_option.to_sym
|
23
|
+
def sortify(sort_option = "")
|
24
|
+
sort_option = sort_option.to_sym unless sort_option == nil
|
25
25
|
|
26
26
|
if @sort_options.include? sort_option
|
27
27
|
self.send(sort_option)
|