Class: Culpa::BrickchainExecutor
- Inherits:
-
Object
- Object
- Culpa::BrickchainExecutor
- Defined in:
- lib/culpa/brickchain_helpers.rb
Constant Summary collapse
- @@injected_keywords =
{}
Instance Attribute Summary collapse
-
#envelope ⇒ Object
readonly
Returns the value of attribute envelope.
-
#session ⇒ Object
readonly
Returns the value of attribute session.
Class Method Summary collapse
Instance Method Summary collapse
- #async(&blk) ⇒ Object
- #e ⇒ Object
-
#initialize(envelope, request, session) ⇒ BrickchainExecutor
constructor
A new instance of BrickchainExecutor.
- #method_missing(sym, *args) ⇒ Object
Constructor Details
#initialize(envelope, request, session) ⇒ BrickchainExecutor
Returns a new instance of BrickchainExecutor.
13 14 15 16 17 |
# File 'lib/culpa/brickchain_helpers.rb', line 13 def initialize(envelope, request, session) @envelope = envelope @request = request @session = session end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/culpa/brickchain_helpers.rb', line 29 def method_missing(sym, *args) if @@injected_keywords.has_key? sym method = @@injected_keywords[sym] instance_exec args, &method else CallHolder.new(sym.to_s, @envelope, @request, @session) end end |
Instance Attribute Details
#envelope ⇒ Object (readonly)
Returns the value of attribute envelope.
4 5 6 |
# File 'lib/culpa/brickchain_helpers.rb', line 4 def envelope @envelope end |
#session ⇒ Object (readonly)
Returns the value of attribute session.
5 6 7 |
# File 'lib/culpa/brickchain_helpers.rb', line 5 def session @session end |
Class Method Details
.inject_keyword!(keyword, &call) ⇒ Object
9 10 11 |
# File 'lib/culpa/brickchain_helpers.rb', line 9 def self.inject_keyword!(keyword, &call) @@injected_keywords[keyword] = call end |
Instance Method Details
#async(&blk) ⇒ Object
19 20 21 22 23 |
# File 'lib/culpa/brickchain_helpers.rb', line 19 def async(&blk) asb = AsyncBrickchain.new(@envelope, @request, @session) asb.instance_eval(&blk) asb.chs.each { |call_holder| call_holder.thread.join } end |
#e ⇒ Object
25 26 27 |
# File 'lib/culpa/brickchain_helpers.rb', line 25 def e @envelope end |