ruby/docs.ruby-lang.org

Ruby Core Objects Diagram

ArtemSyzonenko opened this issue · 9 comments

Please consider this diagram to be placed on the website:

http://www.gliffy.com/go/publish/5152080

dmke commented

I might be wrong, but aren't Date and DateTime only part of the standard library and not part of Ruby core?

It seems you are right. I added it because of @postmodern notice:

" just noticed that you forgot DateTime, and that Time/Date/DateTime include Comparable."

dmke commented

Slight off-topic: I've just double checked and found an interesting behavior:

$ rbenv shell 2.0.0-p353
$ ruby -e 'p defined? Date'    
"constant"
$ ruby -e 'p [Date, Date.class, Date.superclass, Date.included_modules, Date.instance_methods - Object.instance_methods, Date.method(:new).source_location]'
[Date, Class, Object, [Kernel], [], nil]
$ ruby -e 'p defined? DateTime'
nil

Time to investigate 😄

I see Time here: http://www.ruby-doc.org/core-2.0.0/

But Date here: http://www.ruby-doc.org/stdlib-2.0.0/

So according to documentation I think your notice is correct.

zzak commented

Date is only available from the stdlib

dmke commented

Sure, the known/expected behaviour is available after a require 'date', but the actual class Date seems already present before that (although empty, as shown above).

I haven't found out why that is yet; maybe some core lib does a forward reference of the Date class, maybe it's a bug, maybe it's an optimization. As I said: time to investigate 😉

I was just searching for a diagram like this and ended up here from reddit. I think @zowal has created a great resource for those of us who want to know all of Ruby core.

Seeing as this is 2 years old now, what's the status on this? What do we need to do to get this on the website?

hsbt commented

I'm not against this proposal. but I have no idea to put this diagram to docs.ruby-lang.org.

If you have practical idea and pull request, I will merge it.