Skip to content

Commit

Permalink
Fix Struct inheritance
Browse files Browse the repository at this point in the history
  • Loading branch information
meh committed Oct 17, 2013
1 parent 27c9eed commit 9677ea3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions corelib/struct.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ def self.members
@members ||= []
end

def self.inherited(klass)
return if self == Struct

members = @members

klass.instance_eval {
@members = members
}
end

include Enumerable

def initialize(*args)
Expand Down

0 comments on commit 9677ea3

Please sign in to comment.