Module: RactorShack::ShareableGuaranteed::InstanceOverrides

Defined in:
lib/ractor_shack/shareable_guaranteed.rb

Instance Method Summary collapse

Instance Method Details

#<<(message, move: false) ⇒ Object



83
84
85
86
87
88
89
90
91
# File 'lib/ractor_shack/shareable_guaranteed.rb', line 83

def <<(message, move: false)
  unless move || Ractor.shareable?(message)
    if ShareableGuaranteed.consider_shareable.none? { |klass| message.is_a?(klass) }
      ::Kernel.raise NonShareableSentToRactorError.new(self, message)
    end
  end

  super
end

#send(message, move: false) ⇒ Object

TODO: DRY these two up! See if alias gets the job done.



73
74
75
76
77
78
79
80
81
# File 'lib/ractor_shack/shareable_guaranteed.rb', line 73

def send(message, move: false)
  unless move || Ractor.shareable?(message)
    if ShareableGuaranteed.consider_shareable.none? { |klass| message.is_a?(klass) }
      ::Kernel.raise NonShareableSentToRactorError.new(self, message)
    end
  end

  super
end