Class: Rails::Configuration::MiddlewareStackProxy

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/panda/core/middleware.rb

Overview

Add a tiny compatibility layer so the proxy can be inspected and reset in tests.

Defined Under Namespace

Classes: MiddlewareEntry

Instance Method Summary collapse

Instance Method Details

#[](index) ⇒ Object



25
26
27
# File 'lib/panda/core/middleware.rb', line 25

def [](index)
  to_a[index]
end

#clearObject



11
12
13
14
15
# File 'lib/panda/core/middleware.rb', line 11

def clear
  operations.clear
  delete_operations.clear
  self
end

#each(&block) ⇒ Object



17
18
19
# File 'lib/panda/core/middleware.rb', line 17

def each(&block)
  to_stack.each { |mw| block.call(wrap_middleware(mw)) }
end

#firstObject



29
30
31
# File 'lib/panda/core/middleware.rb', line 29

def first
  to_a.first
end

#lastObject



33
34
35
# File 'lib/panda/core/middleware.rb', line 33

def last
  to_a.last
end

#sizeObject



37
38
39
# File 'lib/panda/core/middleware.rb', line 37

def size
  to_a.size
end

#to_aObject



21
22
23
# File 'lib/panda/core/middleware.rb', line 21

def to_a
  map(&:itself)
end