Docunext

  • About

Ruby s Autoload Mechanism While Developing Gems

May 23rd, 2010

I'm making some modifications to a fork of a gem which I offers the functionality I'm looking for but lacks configuration capabilities I need.

I found that the gem uses Ruby's autoload mechanism, which I've read is a good thing, but the paths it was using messed me up.

This is what I've changed to make it work for me:

5,6c4,5
<   self.autoload :LibTidy, File.dirname(__FILE__) + '/tidy_ffi/lib_tidy'
<   self.autoload :Interface, File.dirname(__FILE__) + '/tidy_ffi/interface'
---
>   self.autoload :LibTidy, 'tidy_ffi/lib_tidy'
>   self.autoload :Interface, 'tidy_ffi/interface'
9,11c8,10
< require File.dirname(__FILE__) + '/tidy_ffi/options_container'
< require File.dirname(__FILE__) + '/tidy_ffi/tidy'
< require File.dirname(__FILE__) + '/tidy_ffi/tidy_ffi_extensions'
\ No newline at end of file
---
> require 'tidy_ffi/options_container'
> require 'tidy_ffi/tidy'
> require 'tidy_ffi/tidy_ffi_extensions'
\ No newline at end of file
Yearly Indexes: 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2015 2019 2020