Class: Metaparticle::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/metaparticle/base.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, *args, &block) ⇒ Base

Returns a new instance of Base.



9
10
11
12
13
14
15
16
17
18
# File 'lib/metaparticle/base.rb', line 9

def initialize(app, *args, &block)
  @app = app
  if block_given?
    if block.arity == 1
      block.call(self)
    else
      instance_eval(&block)
    end
  end
end

Instance Method Details

#call(env) ⇒ Object



20
21
22
# File 'lib/metaparticle/base.rb', line 20

def call(env)
  @app.call(env)
end

#containerize(&block) ⇒ Object



24
25
26
27
# File 'lib/metaparticle/base.rb', line 24

def containerize(&block)
  @config = OpenStruct.new(block.call)
  run!
end