Class: TagLayout::WalkManualWellsByPools

Inherits:
Walker
  • Object
show all
Defined in:
app/models/tag_layout/walk_manual_wells_by_pools.rb

Instance Attribute Summary

Attributes inherited from Walker

#tag_layout

Instance Method Summary collapse

Methods inherited from Walker

#apply_tags, #initialize

Constructor Details

This class inherits a constructor from TagLayout::Walker

Instance Method Details

#walk_wellsObject



5
6
7
8
9
10
11
12
13
# File 'app/models/tag_layout/walk_manual_wells_by_pools.rb', line 5

def walk_wells
  # This is much simple than the automated method
  wells_in_pools = wells_in_walking_order.with_pool_id.group_by(&:pool_id)

  # Now we can walk the wells in the groups, skipping any that have been nil'd by the above code.
  wells_in_pools.each do |_pool, wells|
    wells.each_with_index { |(well, _), index| yield(well, index) unless well.nil? }
  end
end