Class: CustomSort::Magic
- Inherits:
-
Object
- Object
- CustomSort::Magic
- Defined in:
- lib/custom_sort/magic.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Enumerable, Relation
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#query_name ⇒ Object
Returns the value of attribute query_name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(query_name:, **options) ⇒ Magic
constructor
A new instance of Magic.
Constructor Details
#initialize(query_name:, **options) ⇒ Magic
Returns a new instance of Magic.
7 8 9 10 |
# File 'lib/custom_sort/magic.rb', line 7 def initialize(query_name:, **) @query_name = query_name @options = end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
5 6 7 |
# File 'lib/custom_sort/magic.rb', line 5 def @options end |
#query_name ⇒ Object
Returns the value of attribute query_name.
5 6 7 |
# File 'lib/custom_sort/magic.rb', line 5 def query_name @query_name end |
Class Method Details
.validate_period(period, permit) ⇒ Object
12 13 14 15 |
# File 'lib/custom_sort/magic.rb', line 12 def self.validate_period(period, permit) permitted_periods = ((permit || CustomSort::FIELDS).map(&:to_sym) & CustomSort::FIELDS).map(&:to_s) raise ArgumentError, "Unpermitted period" unless permitted_periods.include?(period.to_s) end |