Class: Farce::Local::LazyRef

Inherits:
Reference show all
Defined in:
lib/farce/local/lazy_ref.rb

Overview

A Reference for a Local::Lazy value. Freezing affects the current scope's target. Afterward, frozen? reflects the current target and may initialize it when entering another scope.

Examples:

# Delegate to a Ractor-local hash
lazy_ref = Farce::Local::LazyRef.new { {} }

lazy_ref[:key] = :value
lazy_ref[:key] # => :value

Ractor.new(lazy_ref) do |lazy_ref|
  lazy_ref[:key] # => nil
end

Method Summary

Methods inherited from Reference

[], deref, #duplicable?, #freeze, #frozen?, #initialize, new, #respond_to?

Constructor Details

This class inherits a constructor from Farce::Reference

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Farce::Reference