зеркало из https://github.com/github/ruby.git
replaced the local variable 'entity' with an instance variable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
4c2929e152
Коммит
597a64146f
|
@ -17,16 +17,15 @@ module DL
|
|||
module CStructBuilder
|
||||
def create(klass, types, members)
|
||||
new_class = Class.new(klass){
|
||||
entity = nil
|
||||
define_method(:initialize){|addr|
|
||||
entity = klass.entity_class.new(addr, types)
|
||||
entity.assign_names(members)
|
||||
@entity = klass.entity_class.new(addr, types)
|
||||
@entity.assign_names(members)
|
||||
}
|
||||
define_method(:to_ptr){ entity }
|
||||
define_method(:to_i){ entity.to_i }
|
||||
define_method(:to_ptr){ @entity }
|
||||
define_method(:to_i){ @entity.to_i }
|
||||
members.each{|name|
|
||||
define_method(name){ entity[name] }
|
||||
define_method(name + "="){|val| entity[name] = val }
|
||||
define_method(name){ @entity[name] }
|
||||
define_method(name + "="){|val| @entity[name] = val }
|
||||
}
|
||||
}
|
||||
size = klass.entity_class.size(types)
|
||||
|
|
Загрузка…
Ссылка в новой задаче