callable_tree 0.3.7 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'callable_tree'
4
-
5
- module Node
6
- class HooksSample
7
- include CallableTree::Node::Internal
8
- prepend CallableTree::Node::Hooks::Caller
9
- end
10
- end
11
-
12
- Node::HooksSample
13
- .new
14
- .before_caller do |input, **_options|
15
- puts "before_caller input: #{input}"
16
- input + 1
17
- end
18
- .append(
19
- # anonymous external node
20
- lambda do |input, **_options|
21
- puts "external input: #{input}"
22
- input * 2
23
- end
24
- )
25
- .around_caller do |input, **_options, &block|
26
- puts "around_caller input: #{input}"
27
- output = block.call
28
- puts "around_caller output: #{output}"
29
- output * input
30
- end
31
- .after_caller do |output, **_options|
32
- puts "after_caller output: #{output}"
33
- output * 2
34
- end
35
- .tap do |tree|
36
- options = { foo: :bar }
37
- output = tree.call(1, **options)
38
- puts "result: #{output}"
39
- end