class Sanity::Groq::Order
Constants
- RESERVED
Attributes
order[R]
val[R]
Public Class Methods
call(**args)
click to toggle source
# File lib/sanity/groq/order.rb, line 7 def call(**args) new(**args).call end
new(**args)
click to toggle source
# File lib/sanity/groq/order.rb, line 16 def initialize(**args) args.slice(*RESERVED).then do |opts| @order = opts[:order] end @val = +"" end
Public Instance Methods
call()
click to toggle source
# File lib/sanity/groq/order.rb, line 24 def call return unless order raise ArgumentError, "order must be hash" unless order.is_a?(Hash) order.to_a.each_with_index do |(key, sort), idx| val << " | order(#{key} #{sort})".then do |str| idx.positive? ? str : str.strip end end val end