Module: ROC::Types::SortableType
Instance Method Summary collapse
-
#sort(opts = {}) ⇒ Object
c.value :by c.splat :limit c.multi :get c.words :order c.value :store.
- #sort!(opts = {}) ⇒ Object
Instance Method Details
#sort(opts = {}) ⇒ Object
c.value :by
c.splat :limit
c.multi :get
c.words :order
c.value :store
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/roc/types/sortable_type.rb', line 11 def sort(opts={}) raise ":by not yet supported" if opts.has_key?(:by) raise ":get not yet supported" if opts.has_key?(:by) store = opts[:store] if store.is_a?(ROC::List) store = store.key elsif !store.nil? && !store.is_a?(::String) raise "unsupported :store value" end self.call :sort, {:store => store, :limit => opts[:limit], :order => opts[:order]} end |
#sort!(opts = {}) ⇒ Object
25 26 27 28 |
# File 'lib/roc/types/sortable_type.rb', line 25 def sort!(opts={}) raise ":store is self in sort!" if opts.has_key?(:store) self.sort({:store => self.key}.merge(opts.dup)) end |