Ruby - Metaprogramming Fundamentals
What will this Ruby code print?
class Test
[:a, :b].each do |name|
define_method(name) { name.to_s.upcase }
end
end
t = Test.new
puts t.a + t.b