Class: Smith::Workflow::Composite::ValueBudget

Inherits:
Object
  • Object
show all
Extended by:
Dry::Initializer
Defined in:
lib/smith/workflow/composite/value_budget.rb

Instance Method Summary collapse

Constructor Details

#initializeValueBudget

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