Sha256: d57e56546d369829e5292059c0a4d3687dfdb87b795511b61789c75817d1085a
Contents?: true
Size: 1.22 KB
Versions: 134
Compression:
Stored size: 1.22 KB
Contents
# frozen-string-literal: true # # These modifies virtual row blocks so that you can pass a block # when calling a method to change the behavior. It only exists # for backwards compatibility with previous Sequel versions, and # is not recommended for new applications. # # To load the extension: # # Sequel.extension :virtual_row_method_block # module Sequel module SQL class VirtualRow < BasicObject include(Module.new do # Handle blocks passed to methods and change the behavior. def method_missing(m, *args, &block) if block if args.empty? Function.new(m) else case args.shift when :* Function.new(m, *args).* when :distinct Function.new(m, *args).distinct when :over opts = args.shift || OPTS f = Function.new(m, *::Kernel.Array(opts[:args])) f = f.* if opts[:*] f.over(opts) else Kernel.raise(Error, 'unsupported VirtualRow method argument used with block') end end else super end end end) end end end
Version data entries
134 entries across 117 versions & 2 rubygems