Sha256: f60f99c902690386f88340bf74eedd3fc1fb9bf9c636f6a5fb6136c0814876b7
Contents?: true
Size: 587 Bytes
Versions: 4
Compression:
Stored size: 587 Bytes
Contents
module BB module Converter class Order TEMPLATE = "%s %s".freeze attr_reader :column, :sort_key def initialize(column, options = {}) @column = column @sort_key = format_sort_key(options[:sort_key]) end def convert format(TEMPLATE, column, sort_key) end private def format_sort_key(sort_key) sort_key.to_s.casecmp("DESC").zero? ? :DESC : :ASC end class << self def convert(column, options = {}) new(column, options).convert end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
b_b-0.1.3 | lib/b_b/converter/order.rb |
b_b-0.1.2 | lib/b_b/converter/order.rb |
b_b-0.1.1 | lib/b_b/converter/order.rb |
b_b-0.1.0 | lib/b_b/converter/order.rb |