Class: Faraday::RackBuilder::Handler

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Instance Attribute Details

#nameObject (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



45
46
47
48
49
50
51
52
53
# File 'lib/faraday/rack_builder.rb', line 45

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



55
56
57
# File 'lib/faraday/rack_builder.rb', line 55

def build(app = nil)
  klass.new(app, *@args, &@block)
end

#inspectObject



41
42
43
# File 'lib/faraday/rack_builder.rb', line 41

def inspect
  @name
end

#klassObject



37
38
39
# File 'lib/faraday/rack_builder.rb', line 37

def klass
  REGISTRY.get(@name)
end