Skip to content

Commit 40cc276

Browse files
committed
Fix issue with defining some openstruct methods
1 parent 1694c3d commit 40cc276

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/yard/open_struct.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,10 @@ def marshal_load(data)
5757
private
5858

5959
def __cache_lookup__(name)
60+
key = name.to_sym.inspect
6061
instance_eval <<-RUBY, __FILE__, __LINE__ + 1
61-
def #{name}; @table[:#{name}]; end
62-
def #{name}=(v); @table[:#{name}] = v; end
62+
def #{name}; @table[#{key}]; end
63+
(class << self; self; end).define_method("#{name}=") { |v| @table[#{key}] = v }
6364
RUBY
6465
end
6566
end

0 commit comments

Comments
 (0)