Class: Momomoto::Order::Lower
- Inherits:
-
Momomoto::Order
- Object
- Momomoto::Order
- Momomoto::Order::Lower
- Defined in:
- lib/momomoto/order.rb
Overview
This class is used for case-insensitive orders. It is derived from the Order class where you can find more information on usage.
Instance Attribute Summary
Attributes inherited from Momomoto::Order
Instance Method Summary collapse
-
#function(argument) ⇒ Object
Translates all +argument+s to the SQL statement.
-
#initialize(*fields) ⇒ Lower
constructor
Creates a new instance of Lower and flattens the given parameter
fields.
Methods inherited from Momomoto::Order
Constructor Details
#initialize(*fields) ⇒ Lower
77 78 79 80 81 82 83 |
# File 'lib/momomoto/order.rb', line 77 def initialize( *fields ) fields = fields.flatten fields.each do | field | raise Error, "Asc and Desc are only allowed as toplevel order elements" if field.kind_of?( Asc ) or field.kind_of?( Desc ) end @fields = fields end |
Instance Method Details
#function(argument) ⇒ Object
Translates all +argument+s to the SQL statement. Returns the joined arguments.
87 88 89 90 91 |
# File 'lib/momomoto/order.rb', line 87 def function( argument ) argument = [ argument ] if not argument.kind_of?( Array ) argument = argument.map{|a| "lower(#{a})"} argument.join(',') end |