Module: Sortify
- Includes:
- WhitelistScope
- Defined in:
- lib/sortify.rb,
lib/sortify/version.rb
Constant Summary collapse
- VERSION =
"0.1.9".freeze
Instance Method Summary collapse
Instance Method Details
#default_sort_option(name) ⇒ Object
8 9 10 |
# File 'lib/sortify.rb', line 8 def default_sort_option(name) @default_sort_option = name.to_sym end |
#sortify(sort_option = "") ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/sortify.rb', line 12 def sortify(sort_option = "") if sort_option.empty? begin call_whitelisted_scope(@default_sort_option) rescue raise NoMethodError, "The default sort option you provided, '#{@default_sort_option}', does not exist." end else call_whitelisted_scope(sort_option) end end |