class Safrano::MultiOrder

complex ordering logic

Public Class Methods

new(orderstr, jh) click to toggle source
Calls superclass method Safrano::Order::new
# File lib/odata/collection_order.rb, line 72
def initialize(orderstr, jh)
  super
  @olist = []
  @jh = jh
  @orderstr = orderstr.dup
  @olist = orderstr.split(',').map { |ostr| Order.new(ostr, @jh) }
end

Public Instance Methods

apply_to_dataset(dtcx) click to toggle source
# File lib/odata/collection_order.rb, line 80
def apply_to_dataset(dtcx)
  @olist.each { |osingl| dtcx = osingl.apply_to_dataset(dtcx) }
  dtcx
end
parse_error?() click to toggle source
# File lib/odata/collection_order.rb, line 85
def parse_error?
  @orderstr.split(',').each do |pord|
    pord.strip!
    qualfn, dir = pord.split(/\s/)
    qualfn.strip!
    dir.strip! if dir
    return true unless @jh.start_model.attrib_path_valid? qualfn
    return true unless [nil, 'asc', 'desc'].include? dir
  end

  false
end