Class: FocusActor::FutureProcessor
- Inherits:
-
Object
- Object
- FocusActor::FutureProcessor
- Defined in:
- lib/focus_actor/future_processor.rb
Instance Attribute Summary collapse
-
#instance ⇒ Object
readonly
Returns the value of attribute instance.
Instance Method Summary collapse
-
#initialize(instance) ⇒ FutureProcessor
constructor
A new instance of FutureProcessor.
- #method_missing(method, *args, &block) ⇒ Object
- #respond_to_missing?(method, include_all = false) ⇒ Boolean
Constructor Details
#initialize(instance) ⇒ FutureProcessor
Returns a new instance of FutureProcessor.
8 9 10 |
# File 'lib/focus_actor/future_processor.rb', line 8 def initialize(instance) @instance = instance end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/focus_actor/future_processor.rb', line 12 def method_missing(method, *args, &block) return super unless instance.respond_to?(method) queue = Queue.new Thread.new do queue.push instance.public_send(method, *args, &block) end FutureCell.new(queue) end |
Instance Attribute Details
#instance ⇒ Object (readonly)
Returns the value of attribute instance.
6 7 8 |
# File 'lib/focus_actor/future_processor.rb', line 6 def instance @instance end |
Instance Method Details
#respond_to_missing?(method, include_all = false) ⇒ Boolean
23 24 25 |
# File 'lib/focus_actor/future_processor.rb', line 23 def respond_to_missing?(method, include_all = false) instance.respond_to?(method) || super end |