class Sequel::SQL::DelayedEvaluation

  1. lib/sequel/sql.rb
Superclass: GenericExpression

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

Methods

Public Class

  1. new

Public Instance

  1. call
  2. callable

Attributes

callable [R]

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

Public Class methods

new(callable)

Set the callable object

[show source]
     # File lib/sequel/sql.rb
1344 def initialize(callable)
1345   @callable = callable
1346   freeze
1347 end

Public Instance methods

call(ds)

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

[show source]
     # File lib/sequel/sql.rb
1352 def call(ds)
1353   if @callable.respond_to?(:arity) && @callable.arity == 1
1354     @callable.call(ds)
1355   else
1356     @callable.call
1357   end
1358 end