Early on in the application boot process. In our case, that effectively
means that the code in the C extension's Init_wikitext() function will
be evaluated.
So, in this commit, we replicate in C what we would have done in the
following manner if the Wikitext gem were just a pure Ruby project:
if Object.const_defined? :ActiveSupport
# we are running under Rails
require 'wikitext/nil_class'
require 'wikitext/string'
if ActiveSupport.respond_to? :on_load
# running under Rails 3
ActiveSupport.on_load :action_view do
require 'wikitext/rails_template_handler'
end
else
# running under Rails 2
require 'wikitext/rails_template_handler'
end
Note that because one of the code paths involves passing in a block, we
have to define a couple of ancilliary helper functions and use
rb_iterate() to achieve the same effect in C.