Id like to have a def that I can scope in one go, i.e.,

class A
  scoped_def :private, :a do
    
  end
end

at least until we get decorators in Ruby.  The following seems to work:

class Class
  def scoped_def scope, name, &blk
    if [:public, :protected, :private].include? scope
      define_method name, &blk
      self.send scope, name
    else
      raise ArgumentError, "illegal visibility: %s", scope  
    end
  end
end

I was wondering if anyone has any comments regarding this solution.

Would it be better to put it in Object (wrapping it in a class_eval)
and, if so, why?

Thanks,
        nikolai

-- 
Nikolai Weibull: now available free of charge at http://bitwi.se/!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}