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 1278 1278: def initialize(callable) 1279: @callable = callable 1280: freeze 1281: 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 1286 1286: def call(ds) 1287: if @callable.respond_to?(:arity) && @callable.arity == 1 1288: @callable.call(ds) 1289: else 1290: @callable.call 1291: end 1292: end