Module: Farce::Shareable::Immutable

Includes:
Farce::Shareable, Internal::Freeze::Immutable
Included in:
Deduper, ModeManager, ThreadScheduler
Defined in:
lib/farce/shareable.rb

Overview

An immutable object whose structural and logical frozen states are the same. Set instance variables before calling super from initialize.

Examples:

Publish an immutable value

class Point
  include Farce::Shareable::Immutable
  attr_reader :x, :y

  def initialize(x, y)
    @x, @y = x, y
    super()
  end
end

point = Point.new(1, 2)
point.frozen? # => true
Ractor.shareable?(point) # => true

Method Summary

Methods included from Farce::Shareable

#initialize, #ractor_shareable?