Class: Grape::Middleware::Stack::Middleware
- Inherits:
-
Object
- Object
- Grape::Middleware::Stack::Middleware
- Defined in:
- lib/grape/middleware/stack.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(klass, *args, &block) ⇒ Middleware
constructor
A new instance of Middleware.
- #inspect ⇒ Object
- #name ⇒ Object
- #use_in(builder) ⇒ Object
Constructor Details
#initialize(klass, *args, &block) ⇒ Middleware
Returns a new instance of Middleware.
11 12 13 14 15 |
# File 'lib/grape/middleware/stack.rb', line 11 def initialize(klass, *args, &block) @klass = klass @args = args @block = block end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
9 10 11 |
# File 'lib/grape/middleware/stack.rb', line 9 def args @args end |
#block ⇒ Object (readonly)
Returns the value of attribute block.
9 10 11 |
# File 'lib/grape/middleware/stack.rb', line 9 def block @block end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
9 10 11 |
# File 'lib/grape/middleware/stack.rb', line 9 def klass @klass end |
Instance Method Details
#==(other) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/grape/middleware/stack.rb', line 21 def ==(other) case other when Middleware klass == other.klass when Class klass == other || (name.nil? && klass.superclass == other) end end |
#inspect ⇒ Object
30 31 32 |
# File 'lib/grape/middleware/stack.rb', line 30 def inspect klass.to_s end |
#name ⇒ Object
17 18 19 |
# File 'lib/grape/middleware/stack.rb', line 17 def name klass.name end |
#use_in(builder) ⇒ Object
34 35 36 |
# File 'lib/grape/middleware/stack.rb', line 34 def use_in(builder) builder.use(@klass, *@args, &@block) end |