Class: RMXExecutionBlock
- Inherits:
-
Object
- Object
- RMXExecutionBlock
- Defined in:
- lib/motion/RMXExecutionBlock.rb
Instance Attribute Summary collapse
-
#dead ⇒ Object
Returns the value of attribute dead.
-
#desc ⇒ Object
Returns the value of attribute desc.
-
#limit ⇒ Object
Returns the value of attribute limit.
-
#meta ⇒ Object
Returns the value of attribute meta.
-
#queue ⇒ Object
Returns the value of attribute queue.
-
#strong ⇒ Object
Returns the value of attribute strong.
-
#the_block ⇒ Object
Returns the value of attribute the_block.
Instance Method Summary collapse
Instance Attribute Details
#dead ⇒ Object
Returns the value of attribute dead.
2 3 4 |
# File 'lib/motion/RMXExecutionBlock.rb', line 2 def dead @dead end |
#desc ⇒ Object
Returns the value of attribute desc.
2 3 4 |
# File 'lib/motion/RMXExecutionBlock.rb', line 2 def desc @desc end |
#limit ⇒ Object
Returns the value of attribute limit.
2 3 4 |
# File 'lib/motion/RMXExecutionBlock.rb', line 2 def limit @limit end |
#meta ⇒ Object
Returns the value of attribute meta.
2 3 4 |
# File 'lib/motion/RMXExecutionBlock.rb', line 2 def @meta end |
#queue ⇒ Object
Returns the value of attribute queue.
2 3 4 |
# File 'lib/motion/RMXExecutionBlock.rb', line 2 def queue @queue end |
#strong ⇒ Object
Returns the value of attribute strong.
2 3 4 |
# File 'lib/motion/RMXExecutionBlock.rb', line 2 def strong @strong end |
#the_block ⇒ Object
Returns the value of attribute the_block.
2 3 4 |
# File 'lib/motion/RMXExecutionBlock.rb', line 2 def the_block @the_block end |
Instance Method Details
#actual_queue ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/motion/RMXExecutionBlock.rb', line 10 def actual_queue q = queue if q == :async q = RMXEventsFromProxy::QUEUE elsif q == :main q = Dispatch::Queue.main end q ||= Dispatch::Queue.main q end |
#block=(_block) ⇒ Object
5 6 7 8 |
# File 'lib/motion/RMXExecutionBlock.rb', line 5 def block=(_block) self.block_owner = _block.owner self.the_block = RMX.safe_block(_block) end |
#call(*args) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/motion/RMXExecutionBlock.rb', line 21 def call(*args) should_cleanup = false if !dead && (blk = the_block) && (o = block_owner) && (q = actual_queue) q.async do blk.call(*args) blk o end else should_cleanup = true end if limit if limit > 0 self.limit -= 1 end if limit == 0 should_cleanup = true end end if should_cleanup self.dead = true self.strong = nil self. = nil self.limit = nil self.the_block = nil self.block_owner = nil end end |