Class: AmazingPrint::ExtLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/amazing_print/ext_loader.rb

Overview

Attempt to load extensions up to 3 times since this library may be required before dependencies that we have extensions for.

Constant Summary collapse

EXT_LOAD_ATTEMPT_LIMIT =
3

Class Method Summary collapse

Class Method Details

.callObject



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/amazing_print/ext_loader.rb', line 13

def self.call
  return if @load_attemps >= EXT_LOAD_ATTEMPT_LIMIT

  require_relative 'ext/mongo_mapper'   if defined?(MongoMapper)
  require_relative 'ext/mongoid'        if defined?(Mongoid)
  require_relative 'ext/nobrainer'      if defined?(NoBrainer)
  require_relative 'ext/nokogiri'       if defined?(Nokogiri)
  require_relative 'ext/ostruct'        if defined?(OpenStruct) # rubocop:disable Style/OpenStructUse
  require_relative 'ext/ripple'         if defined?(Ripple)
  require_relative 'ext/sequel'         if defined?(Sequel)

  @load_attemps += 1
end