Sha256: 5f413da96d1deb4c2bc2d58420c2f652018920916871519e8871ad2288e80699
Contents?: true
Size: 558 Bytes
Versions: 5
Compression:
Stored size: 558 Bytes
Contents
module Quandl module Operation class Sort class << self def order?(data) return :none if data.blank? || data[0].blank? || data[1].blank? data[0][0] > data[1][0] ? :desc : :asc end def order(data, order = :asc) # ascending case order when :asc then data = sort_asc(data) when :desc then data = sort_desc(data) end data end def asc(data) data.sort_by{|r| r[0] } end def desc(data) data.sort_by{|r| r[0] }.reverse end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems