S
salamond
Hi, all.
I came across the following problem.
I need to generate a couple of methods,
by now, I'm using
acode = lambda {
puts "i am a student in class " + c
}
bcode = lambda {
puts "class "+c+ "is a great class"
}
["a", "b", "c"].each do |c|
define_method("student_in_class"+c, acode)
define_method("greate_class"+c, bcode)
end
now ruby doesn't seem to recognize c in acode and bcode.
is there any alternatives?
thx
JarodZZ
I came across the following problem.
I need to generate a couple of methods,
by now, I'm using
acode = lambda {
puts "i am a student in class " + c
}
bcode = lambda {
puts "class "+c+ "is a great class"
}
["a", "b", "c"].each do |c|
define_method("student_in_class"+c, acode)
define_method("greate_class"+c, bcode)
end
now ruby doesn't seem to recognize c in acode and bcode.
is there any alternatives?
thx
JarodZZ