class Toil::DynamicValue

Public Class Methods

new(value = nil, &blk) click to toggle source
# File lib/toil/dynamic_value.rb, line 5
def initialize(value = nil, &blk)
  @static = false
  @proc =
    if block_given?
      blk
    elsif value.is_a?(Proc)
      value
    else
      @static = true
      proc { value }
    end
end

Public Instance Methods

call() click to toggle source
# File lib/toil/dynamic_value.rb, line 18
def call
  @proc.call
end
static?() click to toggle source
# File lib/toil/dynamic_value.rb, line 22
def static?
  @static
end