From 40cc2763fde4423f2c1a5c942f58baf5c66caefe Mon Sep 17 00:00:00 2001 From: Loren Segal Date: Tue, 3 Sep 2024 01:09:49 -0700 Subject: [PATCH] Fix issue with defining some openstruct methods --- lib/yard/open_struct.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/yard/open_struct.rb b/lib/yard/open_struct.rb index 5926b2689..d856a6b9f 100644 --- a/lib/yard/open_struct.rb +++ b/lib/yard/open_struct.rb @@ -57,9 +57,10 @@ def marshal_load(data) private def __cache_lookup__(name) + key = name.to_sym.inspect instance_eval <<-RUBY, __FILE__, __LINE__ + 1 - def #{name}; @table[:#{name}]; end - def #{name}=(v); @table[:#{name}] = v; end + def #{name}; @table[#{key}]; end + (class << self; self; end).define_method("#{name}=") { |v| @table[#{key}] = v } RUBY end end