class Safrano::Order
Attributes
oarg[R]
Public Class Methods
new(ostr, jh)
click to toggle source
# File lib/odata/collection_order.rb, line 34 def initialize(ostr, jh) ostr.strip! @orderp = ostr @jh = jh build_oarg if @orderp end
Public Instance Methods
apply_to_dataset(dtcx)
click to toggle source
# File lib/odata/collection_order.rb, line 45 def apply_to_dataset(dtcx) # Warning, we need order_append, simply order(oarg) overwrites # previous one ! dtcx.order_append(@oarg) end
build_oarg()
click to toggle source
# File lib/odata/collection_order.rb, line 51 def build_oarg field, ord = @orderp.split(' ') oargu = if field.include?('/') @assoc, field = field.split('/') @jh.add @assoc Sequel[@jh.start_model.get_alias_sym(@assoc)][field.strip.to_sym] else Sequel[field.strip.to_sym] end @oarg = if ord == 'desc' Sequel.desc(oargu) else Sequel.asc(oargu) end end
empty?()
click to toggle source
# File lib/odata/collection_order.rb, line 41 def empty? false end