Class: EasyOrderable::OrderArgumentsTransformer
- Inherits:
-
Object
- Object
- EasyOrderable::OrderArgumentsTransformer
- Defined in:
- lib/easy_orderable/order_arguments_transformer.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(args) ⇒ OrderArgumentsTransformer
constructor
A new instance of OrderArgumentsTransformer.
Constructor Details
#initialize(args) ⇒ OrderArgumentsTransformer
Returns a new instance of OrderArgumentsTransformer.
3 4 5 |
# File 'lib/easy_orderable/order_arguments_transformer.rb', line 3 def initialize(args) @args = args end |
Instance Method Details
#call ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/easy_orderable/order_arguments_transformer.rb', line 7 def call args.map do |association, direction| if association.include?('.') table_name, column_name = association.split('.') "#{quote(table_name.pluralize)}.#{quote(column_name)} #{direction}" else "#{quote(association)} #{direction}" end end end |