Permalink
Browse files

Don't load mail gem until it's really needed

Implementing ruby autoload on big ugly mikel/mail gem:
huge improvement (around 20%) of padrino framework load speed
  • Loading branch information...
ujifgc committed Jan 10, 2013
1 parent d399600 commit dae883f2a6a38a0edfe00fb47eeb61fb8ffdbbf0
Showing with 5 additions and 2 deletions.
  1. +5 −2 padrino-mailer/lib/padrino-mailer.rb
@@ -5,10 +5,9 @@
require 'sinatra/tilt'
end
require 'padrino-core/support_lite' unless defined?(SupportLite)
require 'mail'
autoload :Mail, 'mail'
# Require respecting order of our dependencies
FileSet.glob_require('padrino-mailer/**/*.rb', __FILE__)
module Padrino
##
@@ -45,6 +44,10 @@ class << self
#
# @api public
def registered(app)
require 'padrino-mailer/base'
autoload :Mail, 'padrino-mailer/ext'
require 'padrino-mailer/helpers'
require 'padrino-mailer/mime'
app.helpers Padrino::Mailer::Helpers
end
alias :included :registered

0 comments on commit dae883f

Please sign in to comment.