Class: Smith::Workflow::Composite::ValueBudget
- Inherits:
-
Object
- Object
- Smith::Workflow::Composite::ValueBudget
- Extended by:
- Dry::Initializer
- Defined in:
- lib/smith/workflow/composite/value_budget.rb
Instance Method Summary collapse
- #add(value, depth: 0) ⇒ Object
-
#initialize ⇒ ValueBudget
constructor
A new instance of ValueBudget.
Constructor Details
#initialize ⇒ ValueBudget
Returns a new instance of ValueBudget.
23 24 25 26 27 |
# File 'lib/smith/workflow/composite/value_budget.rb', line 23 def initialize(...) super @bytes = 0 @nodes = 0 end |
Instance Method Details
#add(value, depth: 0) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/smith/workflow/composite/value_budget.rb', line 29 def add(value, depth: 0) pending = [[value, depth]] until pending.empty? item, item_depth = pending.pop visit!(item, item_depth, pending) end self end |