Class: Faraday::RackBuilder::Handler
- Inherits:
- 
      Object
      
        - Object
- Faraday::RackBuilder::Handler
 
- Defined in:
- lib/faraday/rack_builder.rb
Overview
borrowed from ActiveSupport::Dependencies::Reference & ActionDispatch::MiddlewareStack::Middleware
Constant Summary collapse
- REGISTRY =
- Faraday::AdapterRegistry.new 
Instance Attribute Summary collapse
- 
  
    
      #name  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute name. 
Instance Method Summary collapse
- #==(other) ⇒ Object
- #build(app = nil) ⇒ Object
- 
  
    
      #initialize(klass, *args, **kwargs, &block)  ⇒ Handler 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Handler. 
- #inspect ⇒ Object
- #klass ⇒ Object
Constructor Details
#initialize(klass, *args, **kwargs, &block) ⇒ Handler
Returns a new instance of Handler.
| 30 31 32 33 34 35 36 | # File 'lib/faraday/rack_builder.rb', line 30 def initialize(klass, *args, **kwargs, &block) @name = klass.to_s REGISTRY.set(klass) if klass.respond_to?(:name) @args = args @kwargs = kwargs @block = block end | 
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
| 28 29 30 | # File 'lib/faraday/rack_builder.rb', line 28 def name @name end | 
Instance Method Details
#==(other) ⇒ Object
| 46 47 48 49 50 51 52 53 54 | # File 'lib/faraday/rack_builder.rb', line 46 def ==(other) if other.is_a? Handler name == other.name elsif other.respond_to? :name klass == other else @name == other.to_s end end | 
#build(app = nil) ⇒ Object
| 56 57 58 | # File 'lib/faraday/rack_builder.rb', line 56 def build(app = nil) klass.new(app, *@args, **@kwargs, &@block) end | 
#inspect ⇒ Object
| 42 43 44 | # File 'lib/faraday/rack_builder.rb', line 42 def inspect @name end | 
#klass ⇒ Object
| 38 39 40 | # File 'lib/faraday/rack_builder.rb', line 38 def klass REGISTRY.get(@name) end |