Class: BBK::App::Middlewares::FromBlock
- Defined in:
- lib/bbk/app/middlewares/from_block.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #build(app) ⇒ Object
- #call(msg) ⇒ Object
-
#initialize(&block) ⇒ FromBlock
constructor
A new instance of FromBlock.
Constructor Details
#initialize(&block) ⇒ FromBlock
Returns a new instance of FromBlock.
6 7 8 9 10 |
# File 'lib/bbk/app/middlewares/from_block.rb', line 6 def initialize(&block) raise ArgumentError.new('Not passed block') unless block_given? @block = block end |
Instance Method Details
#build(app) ⇒ Object
12 13 14 15 |
# File 'lib/bbk/app/middlewares/from_block.rb', line 12 def build(app) @app = app self end |
#call(msg) ⇒ Object
17 18 19 |
# File 'lib/bbk/app/middlewares/from_block.rb', line 17 def call(msg) @block.call(app, msg) end |