Class: Signalize::Effect
- Inherits:
-
Object
- Object
- Signalize::Effect
- Defined in:
- lib/signalize.rb
Instance Attribute Summary collapse
-
#_cleanup ⇒ Object
Returns the value of attribute _cleanup.
-
#_compute ⇒ Object
Returns the value of attribute _compute.
-
#_flags ⇒ Object
Returns the value of attribute _flags.
-
#_next_batched_effect ⇒ Object
Returns the value of attribute _next_batched_effect.
-
#_sources ⇒ Object
Returns the value of attribute _sources.
Instance Method Summary collapse
- #_callback ⇒ Object
- #_dispose ⇒ Object
- #_notify ⇒ Object
- #_start ⇒ Object
-
#initialize(compute) ⇒ Effect
constructor
A new instance of Effect.
Constructor Details
Instance Attribute Details
#_cleanup ⇒ Object
Returns the value of attribute _cleanup.
592 593 594 |
# File 'lib/signalize.rb', line 592 def _cleanup @_cleanup end |
#_compute ⇒ Object
Returns the value of attribute _compute.
592 593 594 |
# File 'lib/signalize.rb', line 592 def _compute @_compute end |
#_flags ⇒ Object
Returns the value of attribute _flags.
592 593 594 |
# File 'lib/signalize.rb', line 592 def _flags @_flags end |
#_next_batched_effect ⇒ Object
Returns the value of attribute _next_batched_effect.
592 593 594 |
# File 'lib/signalize.rb', line 592 def _next_batched_effect @_next_batched_effect end |
#_sources ⇒ Object
Returns the value of attribute _sources.
592 593 594 |
# File 'lib/signalize.rb', line 592 def _sources @_sources end |
Instance Method Details
#_callback ⇒ Object
602 603 604 605 606 607 608 609 610 611 612 613 614 615 |
# File 'lib/signalize.rb', line 602 def _callback finis = _start begin compute_executed = false @_cleanup = _compute.() if (@_flags & DISPOSED).zero? && @_compute.nil?.! compute_executed = true ensure unless compute_executed raise Signalize::Error, "Early return or break detected in effect block" end finis.(nil) # TODO: figure out this weird shit end end |
#_dispose ⇒ Object
640 641 642 643 644 |
# File 'lib/signalize.rb', line 640 def _dispose @_flags |= DISPOSED Signalize.dispose_effect(self) unless (@_flags & RUNNING).nonzero? end |
#_notify ⇒ Object
632 633 634 635 636 637 638 |
# File 'lib/signalize.rb', line 632 def _notify unless (@_flags & NOTIFIED).nonzero? @_flags |= NOTIFIED @_next_batched_effect = Signalize.batched_effect Signalize.batched_effect = self end end |
#_start ⇒ Object
617 618 619 620 621 622 623 624 625 626 627 628 629 630 |
# File 'lib/signalize.rb', line 617 def _start Signalize.cycle_detected if (@_flags & RUNNING).nonzero? @_flags |= RUNNING @_flags &= ~DISPOSED Signalize.cleanup_effect(self) Signalize.prepare_sources(self) Signalize.start_batch prev_context = Signalize.eval_context Signalize.eval_context = self Signalize.method(:end_effect).curry(3).call(self, prev_context) # HUH end |