Class: Safrano::MultiOrder
- Defined in:
- lib/odata/collection_order.rb
Overview
complex ordering logic
Constant Summary
Constants inherited from OrderBase
Instance Attribute Summary
Attributes inherited from Order
Instance Method Summary collapse
- #apply_to_dataset(dtcx) ⇒ Object
-
#initialize(orderstr, jh) ⇒ MultiOrder
constructor
A new instance of MultiOrder.
- #parse_error? ⇒ Boolean
Methods inherited from Order
Methods inherited from OrderBase
Constructor Details
#initialize(orderstr, jh) ⇒ MultiOrder
Returns a new instance of MultiOrder.
72 73 74 75 76 77 78 |
# 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 |
Instance Method Details
#apply_to_dataset(dtcx) ⇒ Object
80 81 82 83 |
# 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? ⇒ Boolean
85 86 87 88 89 90 91 92 93 94 95 96 |
# 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 |