module Rack::Handler

def self.try_require(prefix, const_name)

FooBarBaz # => 'foo_bar_baz.rb'
FOOBAR # => 'foobar.rb'
FOObar # => 'foobar.rb'
FooBAR # => 'foobar.rb'
FooBar # => 'foo_bar.rb'
Foo # => 'foo'

Naming convention:

then tries to require them but silences the LoadError if not found
Transforms server-name constants to their canonical form as filenames,
def self.try_require(prefix, const_name)
  file = const_name.gsub(/^[A-Z]+/) { |pre| pre.downcase }.
    gsub(/[A-Z]+[^A-Z]/, '_\&').downcase
  require(::File.join(prefix, file))
  nil
rescue LoadError => error
  error
end