lib/garcon/task/lazy_reference.rb
# The calculated value of the object or the default value if one was given
# at construction. This first time this method is called it will block
# indefinitely while the block is processed. Subsequent calls will not
# block.
#
# @return [Object] the calculated value
#
The calculated value of the object or the default value if one was given
at construction. This first time this method is called it will block
indefinitely while the block is processed. Subsequent calls will not
block.
The calculated value of the object or the default value if one was given at construction . This first time this method is called it will block indefinitely while the block is processed . Subsequent calls will not block .
def value
      return @value if @fulfilled
      @mutex.synchronize do
        unless @fulfilled
          begin
            @value = @task.call
          rescue
            @value = @default
          ensure
            @fulfilled = true
          end
        end
        return @value
      end
    end
def value return @value if @fulfilled @mutex . synchronize do unless @fulfilled begin @value = @task . call rescue @value = @default ensure @fulfilled = true end end return @value end end
The calculated value of the object or the default value if one was given
at construction.
The calculated value of the object or the default value if one was given at construction .
the calculated value
the calculated value
Object