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.

Methods

call   new  

Attributes

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

Public Class methods

Set the callable object

[Source]

      # File lib/sequel/sql.rb, line 1221
1221:       def initialize(callable)
1222:         @callable = callable
1223:       end

Public Instance methods

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

[Source]

      # 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

[Validate]