diff --git a/lib/multipass.rb b/lib/multipass.rb index 54a33c6..ac9f0fa 100644 --- a/lib/multipass.rb +++ b/lib/multipass.rb @@ -99,8 +99,8 @@ def decode(data) CipherError = OpenSSL.const_defined?(:CipherError) ? OpenSSL::CipherError : OpenSSL::Cipher::CipherError - if Object.const_defined?(:ActiveSupport) - include ActiveSupport::Base64 + if defined?(::ActiveSupport) && defined?(::ActiveSupport::Base64) + include ::ActiveSupport::Base64 else require 'base64' end @@ -145,7 +145,7 @@ def self.decode_64(s, url_safe = true) if Object.const_defined?(:ActiveSupport) def decode_json(data, s) ActiveSupport::JSON.decode(s) - rescue ActiveSupport::JSON::ParseError + rescue ActiveSupport::JSON.parse_error raise MultiPass::JSONError.new(data, s) end else