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.



29
30
31
# File 'lib/faraday/rack_builder.rb', line 29

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, &@block)
end

#inspectObject



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

def inspect
  @name
end

#klassObject



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

def klass
  REGISTRY.get(@name)
end