Class: TreeFilter::Defer
- Inherits:
-
Struct
- Object
- Struct
- TreeFilter::Defer
- Includes:
- JsonTerminal
- Defined in:
- lib/tree_filter.rb
Overview
Note:
All data structures containing this object must be filtered before
The wrapped lamda will not be executed unless it is actually required in the filtered response. This can be used for performance optimization, and also to break cycles.
data = {'a' => 1, 'b' => TreeFilter::Defer.new(->{ raise })}
TreeFilter.new("a").filter(data) # => {'a' => 1}
TreeFilter.new("b").filter(data) # => raise
converting to JSON, otherwise you will get a stack overflow error.
Instance Attribute Summary collapse
-
#f ⇒ Object
Returns the value of attribute f.
Instance Method Summary collapse
Methods included from JsonTerminal
Instance Attribute Details
#f ⇒ Object
Returns the value of attribute f
61 62 63 |
# File 'lib/tree_filter.rb', line 61 def f @f end |
Instance Method Details
#call ⇒ Object
64 65 66 |
# File 'lib/tree_filter.rb', line 64 def call f.call end |