Class | Sequel::SQL::DelayedEvaluation |
In: |
lib/sequel/sql.rb
|
Parent: | GenericExpression |
Represents a delayed evaluation, encapsulating a callable object which returns the value to use when called.
callable | [R] | A callable object that returns the value of the evaluation when called. |
Set the callable object
# File lib/sequel/sql.rb, line 1221 1221: def initialize(callable) 1222: @callable = callable 1223: end
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, line 1228 1228: def call(ds) 1229: if @callable.respond_to?(:arity) && @callable.arity == 1 1230: @callable.call(ds) 1231: else 1232: @callable.call 1233: end 1234: end