Class: Jets::Middleware::Layer

Inherits:
Object
  • Object
show all
Defined in:
lib/jets/middleware/layer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass, args, block) ⇒ Layer

Returns a new instance of Layer.



5
6
7
8
9
# File 'lib/jets/middleware/layer.rb', line 5

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

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



3
4
5
# File 'lib/jets/middleware/layer.rb', line 3

def args
  @args
end

#blockObject (readonly)

Returns the value of attribute block.



3
4
5
# File 'lib/jets/middleware/layer.rb', line 3

def block
  @block
end

#klassObject (readonly)

Returns the value of attribute klass.



3
4
5
# File 'lib/jets/middleware/layer.rb', line 3

def klass
  @klass
end

Instance Method Details

#==(middleware) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/jets/middleware/layer.rb', line 13

def ==(middleware)
  case middleware
  when Layer
    klass == middleware.klass
  when Class
    klass == middleware
  end
end

#build(app) ⇒ Object



30
31
32
# File 'lib/jets/middleware/layer.rb', line 30

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

#inspectObject



22
23
24
25
26
27
28
# File 'lib/jets/middleware/layer.rb', line 22

def inspect
  if klass.is_a?(Class)
    klass.to_s
  else
    klass.class.to_s
  end
end

#nameObject



11
# File 'lib/jets/middleware/layer.rb', line 11

def name; klass.name; end