Some little Ruby secrets

have you wondered what is “Printable” doing in the ancestors chain, being a module?

What happens is when you use Module#include in your class, Ruby creates an anonymous class and puts above your class in the ancestors chain. There classes are called include classes . superclass method skips/ignores them as if they don’t exist. and they are not addressable from regular Ruby.


> ?some_string
=> syntax error, unexpected '?'
> ?x
> ?1
Like what you read? Give Shiva Bhusal a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.