class Object
def singleton_class
class << self
self
end
end
end
[String, Array, Hash].each do |klass|
case klass
when String.singleton_class
puts "String!"
when Array.singleton_class
puts "Array!"
when Hash.singleton_class
puts "Hash!"
else
puts "I don't know: #{klass}"
end
end
Hrm it would be nice to have some kind of voting system for feature
requests
http://redmine.ruby-lang.org/issues/show/1082
--
Posted via http://www.ruby-forum.com/.