Skip to content

Commit

Permalink
Fix issue with defining some openstruct methods
Browse files Browse the repository at this point in the history
  • Loading branch information
lsegal committed Sep 3, 2024
1 parent 1694c3d commit 40cc276
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/yard/open_struct.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 40cc276

Please sign in to comment.