hello,

i need to define a number of custom attribute readers on my class. so
far i have come up with two ways to do it. the code below is a
simplified version. but i cannot decide which one is "preferable". whis
one would the experts use? why?

thanks
konstantin

class A
  [:nameof].each { |x| module_eval "def #{x}() @#{x} end" }
  def initialize() @nameof = self.class.to_s end
end

class B
  [:nameof].each { |x| define_method(x) {
instance_variable_get("@#{x}") } }
  def initialize() @nameof = self.class.to_s end
end