Module: Signalize::API
- Included in:
- Signalize
- Defined in:
- lib/signalize.rb
Instance Method Summary collapse
- #batch ⇒ Object
- #computed(&block) ⇒ Object
- #effect(effect_instance = nil, &block) ⇒ Object
- #signal(value) ⇒ Object
- #untracked ⇒ Object
Instance Method Details
#batch ⇒ Object
669 670 671 672 673 674 675 676 677 678 679 |
# File 'lib/signalize.rb', line 669 def batch return yield unless Signalize.batch_depth.zero? Signalize.start_batch begin return yield ensure Signalize.end_batch end end |
#computed(&block) ⇒ Object
652 653 654 |
# File 'lib/signalize.rb', line 652 def computed(&block) Computed.new(block) end |
#effect(effect_instance = nil, &block) ⇒ Object
656 657 658 659 660 661 662 663 664 665 666 667 |
# File 'lib/signalize.rb', line 656 def effect(effect_instance = nil, &block) effect = effect_instance || Effect.new(block) begin effect._callback rescue StandardError => err effect._dispose raise err end effect.method(:_dispose) end |
#signal(value) ⇒ Object
648 649 650 |
# File 'lib/signalize.rb', line 648 def signal(value) Signal.new(value) end |
#untracked ⇒ Object
681 682 683 684 685 686 687 688 689 690 691 692 693 694 |
# File 'lib/signalize.rb', line 681 def untracked return yield unless Signalize.untracked_depth.zero? prev_context = Signalize.eval_context Signalize.eval_context = nil Signalize.untracked_depth += 1 begin return yield ensure Signalize.untracked_depth -= 1 Signalize.eval_context = prev_context end end |