我怎么能给某个特定情况增添新的属性?
For example here I want to add attr_acessors methods to attributes "m1","m2" in object e1 and "m4".."m6" to e2
e1=Element.new("e1",["m1","m2"])
e2=Element.new("e2",["m4","m5","m6"])
e1.m1 = "try"
puts e2.m4
To allow this :
class Element
attr_accessor :name
def initialize name,meths=[]
@name=name
meths.each do |m|
#??
end
end
end