Sha256: 494e6ebf6f9ffb71377de6610dfb9274ff90fc50ff621c7a42b2b176637a076a
Contents?: true
Size: 757 Bytes
Versions: 108
Compression:
Stored size: 757 Bytes
Contents
module Faraday class Middleware extend MiddlewareRegistry class << self attr_accessor :load_error private :load_error= end self.load_error = nil # Executes a block which should try to require and reference dependent libraries def self.dependency(lib = nil) lib ? require(lib) : yield rescue LoadError, NameError => error self.load_error = error end def self.new(*) raise "missing dependency for #{self}: #{load_error.message}" unless loaded? super end def self.loaded? load_error.nil? end def self.inherited(subclass) super subclass.send(:load_error=, self.load_error) end def initialize(app = nil) @app = app end end end
Version data entries
108 entries across 100 versions & 12 rubygems