Skip to content

Commit

Permalink
chore: autoload TwiML to save memory on load (#498)
Browse files Browse the repository at this point in the history
  • Loading branch information
philnash committed Apr 3, 2020
1 parent 76a9923 commit d209e35
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/twilio-ruby.rb
Expand Up @@ -2,7 +2,6 @@

require 'net/http'
require 'net/https'
require 'nokogiri'
require 'cgi'
require 'openssl'
require 'base64'
Expand All @@ -22,11 +21,6 @@
require 'twilio-ruby/security/request_validator'
require 'twilio-ruby/util/configuration'

require 'twilio-ruby/twiml/twiml'
require 'twilio-ruby/twiml/fax_response'
require 'twilio-ruby/twiml/messaging_response'
require 'twilio-ruby/twiml/voice_response'

Dir[File.dirname(__FILE__) + '/twilio-ruby/http/**/*.rb'].sort.each do |file|
require file
end
Expand All @@ -46,6 +40,8 @@
module Twilio
extend SingleForwardable

autoload :TwiML, File.join(File.dirname(__FILE__), 'twilio-ruby', 'twiml', 'twiml.rb')

def_delegators :configuration, :account_sid, :auth_token, :http_client

##
Expand Down
4 changes: 4 additions & 0 deletions lib/twilio-ruby/twiml/twiml.rb
Expand Up @@ -2,6 +2,10 @@

module Twilio
module TwiML
autoload :FaxResponse, File.join(File.dirname(__FILE__), "fax_response.rb")
autoload :MessagingResponse, File.join(File.dirname(__FILE__), "messaging_response.rb")
autoload :VoiceResponse, File.join(File.dirname(__FILE__), "voice_response.rb")

class TwiMLError < StandardError; end

class LeafNode
Expand Down

0 comments on commit d209e35

Please sign in to comment.