Class: Grape::Middleware::Stack::Middleware

Inherits:
Object
  • Object
show all
Defined in:
lib/grape/middleware/stack.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass, *args, &block) ⇒ Middleware

Returns a new instance of Middleware


9
10
11
12
13
# File 'lib/grape/middleware/stack.rb', line 9

def initialize(klass, *args, &block)
  @klass = klass
  @args = args
  @block = block
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args


7
8
9
# File 'lib/grape/middleware/stack.rb', line 7

def args
  @args
end

#blockObject (readonly)

Returns the value of attribute block


7
8
9
# File 'lib/grape/middleware/stack.rb', line 7

def block
  @block
end

#klassObject (readonly)

Returns the value of attribute klass


7
8
9
# File 'lib/grape/middleware/stack.rb', line 7

def klass
  @klass
end

Instance Method Details

#==(other) ⇒ Object


19
20
21
22
23
24
25
26
# File 'lib/grape/middleware/stack.rb', line 19

def ==(other)
  case other
  when Middleware
    klass == other.klass
  when Class
    klass == other || (name.nil? && klass.superclass == other)
  end
end

#inspectObject


28
29
30
# File 'lib/grape/middleware/stack.rb', line 28

def inspect
  klass.to_s
end

#nameObject


15
16
17
# File 'lib/grape/middleware/stack.rb', line 15

def name
  klass.name
end