Module: PumaAfterReply
- Defined in:
- lib/puma_after_reply.rb,
lib/puma_after_reply/version.rb
Overview
Defined Under Namespace
Modules: Config, RepliesRunner Classes: Middleware, ReplyCollector
Constant Summary collapse
- VERSION =
'0.1.0'
Class Method Summary collapse
-
.add_reply(threaded: false, &reply) ⇒ void
Add reply to the reply collector, without any conditions.
-
.call ⇒ void
(also: run)
private
[DEBUGGING METHOD].
-
.clear ⇒ void
private
[DEBUGGING METHOD].
-
.cond_reply(factor, threaded: false, &reply) ⇒ void, Any
Add reply to the reply collector condotionally using the boolean factor.
- .config ⇒ PumaAfterReply::Config
- .configure(&block) ⇒ void
-
.count ⇒ Integer
(also: size)
Return the count of currently added replies.
-
.inline_replies ⇒ Array<#call|Proc>
private
[DEBUGGING METHOD].
-
.replies ⇒ Array<#call|Proc>
private
[DEBUGGING METHOD].
-
.threaded_replies ⇒ Array<#call|Proc>
private
[DEBUGGING METHOD].
Class Method Details
.add_reply(threaded: false, &reply) ⇒ void
This method returns an undefined value.
Add reply to the reply collector, without any conditions.
23 24 25 |
# File 'lib/puma_after_reply.rb', line 23 def add_reply(threaded: false, &reply) ReplyCollector.current.add_reply(reply, threaded:) end |
.call ⇒ void Also known as: run
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
- DEBUGGING METHOD
-
Should not be invoked directly in the business code! Run all currently added replies directly. Imporant: remember that reply collector will be flushed.
113 114 115 |
# File 'lib/puma_after_reply.rb', line 113 def call RepliesRunner.call end |
.clear ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
- DEBUGGING METHOD
124 125 126 |
# File 'lib/puma_after_reply.rb', line 124 def clear ReplyCollector.current.clear end |
.cond_reply(factor, threaded: false, &reply) ⇒ void, Any
Add reply to the reply collector condotionally using the boolean factor. If a factor is a callable object - it will be called and the result will be threatet as a factor. If a factor is a true value => your reply block will be added to the replies collector. If a factor is a false value => your reply block will be yielded immediatly.
40 41 42 43 |
# File 'lib/puma_after_reply.rb', line 40 def cond_reply(factor, threaded: false, &reply) is_addable = factor.respond_to?(:call) ? factor.call : factor is_addable ? add_reply(threaded:, &reply) : yield end |
.config ⇒ PumaAfterReply::Config
58 59 60 |
# File 'lib/puma_after_reply.rb', line 58 def config PumaAfterReply::Config end |
.configure(&block) ⇒ void
This method returns an undefined value.
50 51 52 |
# File 'lib/puma_after_reply.rb', line 50 def configure(&block) Config.configure(&block) end |
.count ⇒ Integer Also known as: size
Return the count of currently added replies.
68 69 70 |
# File 'lib/puma_after_reply.rb', line 68 def count ReplyCollector.current.size end |
.inline_replies ⇒ Array<#call|Proc>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
- DEBUGGING METHOD
89 90 91 |
# File 'lib/puma_after_reply.rb', line 89 def inline_replies ReplyCollector.current.inline_replies end |
.replies ⇒ Array<#call|Proc>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
- DEBUGGING METHOD
79 80 81 |
# File 'lib/puma_after_reply.rb', line 79 def replies ReplyCollector.current.replies end |
.threaded_replies ⇒ Array<#call|Proc>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
- DEBUGGING METHOD
99 100 101 |
# File 'lib/puma_after_reply.rb', line 99 def threaded_replies ReplyCollector.current.threaded_replies end |