diff --git a/ractor.rb b/ractor.rb index 6a83d3a92f..d6eeb987b2 100644 --- a/ractor.rb +++ b/ractor.rb @@ -834,16 +834,26 @@ class Ractor end end - # get a value from ractor-local storage + # get a value from ractor-local storage of current Ractor def [](sym) Primitive.ractor_local_value(sym) end - # set a value in ractor-local storage + # set a value in ractor-local storage of current Ractor def []=(sym, val) Primitive.ractor_local_value_set(sym, val) end + # get a value from ractor-local storage of current Ractor + def self.[](sym) + Primitive.ractor_local_value(sym) + end + + # set a value in ractor-local storage of current Ractor + def self.[]=(sym, val) + Primitive.ractor_local_value_set(sym, val) + end + # returns main ractor def self.main __builtin_cexpr! %q{