Sha256: 99edd988976e195cc98050f3e2968813e0b721b14415779263855f8351491572
Contents?: true
Size: 542 Bytes
Versions: 16
Compression:
Stored size: 542 Bytes
Contents
module Bmg module Sql class Processor class Reorder < Processor def initialize(attr_list, builder) super(builder) @indexes = Hash[attr_list.to_a.map(&:to_s).each_with_index.to_a] end def on_select_list(sexpr) reordered = sexpr.sexpr_body.sort{|i1,i2| @indexes[i1.as_name.to_s] <=> @indexes[i2.as_name.to_s] } reordered.unshift(:select_list) end end # class Reorder end # class Processor end # module Sql end # module Bmg
Version data entries
16 entries across 16 versions & 1 rubygems