class Sequel::SQL::DelayedEvaluation

Represents a delayed evaluation, encapsulating a callable object which returns the value to use when called.

Attributes

callable[R]

A callable object that returns the value of the evaluation when called.

Public Class Methods

new(callable) click to toggle source

Set the callable object

     # File lib/sequel/sql.rb
1340 def initialize(callable)
1341   @callable = callable
1342   freeze
1343 end

Public Instance Methods

call(ds) click to toggle source

Call the underlying callable and return the result. If the underlying callable only accepts a single argument, call it with the given dataset.

     # File lib/sequel/sql.rb
1348 def call(ds)
1349   if @callable.respond_to?(:arity) && @callable.arity == 1
1350     @callable.call(ds)
1351   else
1352     @callable.call
1353   end
1354 end