I’m not abandoning PHP, not by a long shot. My career as a PHP developer has been very good to me. But, I do need to expand the skill set and Ruby seems like an excellent language, and I have the opportunity to use it on a daily basis at my current job.
So a few things I’m looking for right off the bat:
How do I autoload (lazy load) classes? BTW, I’m not using Rails, just Ruby.
This was trivial in PHP either by using the magic function __autoload or by using whatever framework I was in at the time, Zend Framework 1 and 2, CI, etc, and let the framework handle it for me. Looking at Ruby, it seems that I need to be mindful of how thread safe the method I choose to do autoloading.
I read a blog post on the topic and it seems as if the author rolled his own autoloader modeled after the PHP autoloader. He doesn’t mention how thread safe this is. I’ll be revisiting this in the future as I learn more about Ruby, but for now I think I’ll use the autoloader from Mr. Santos.
Is there a “preferred” method for loading classes in Ruby?
Hey man, hopefully this will help.
http://www.rubyinside.com/ruby-techniques-reveale…
Thanks, I was reading about the thread safety of the autoload method, and wanted to find a thread safe solution. Not that I have a need for a thread safe autoloader right now. Maybe I should not worry about it, until I need a thread safe loader.