Skip to content

Commit

Permalink
Don't load mail gem until it's really needed
Browse files Browse the repository at this point in the history
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 dae883f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions padrino-mailer/lib/padrino-mailer.rb
Expand Up @@ -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
##
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit dae883f

Please sign in to comment.