Class: DatacenterRack

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
RocketPants::Cacheable
Defined in:
app/models/datacenter_rack.rb

Instance Method Summary collapse

Instance Method Details

#labelObject


12
13
14
15
16
17
18
19
# File 'app/models/datacenter_rack.rb', line 12

def label
  return name unless name.nil?

  w_f = Math.log(datacenter.max_floors, 16).ceil
  w_r = Math.log(datacenter.max_rows_per_floor, 16).ceil
  w_c = Math.log(datacenter.max_cells_per_row, 16).ceil
  "#{datacenter.rack_prefix}%0#{w_f}X#{custom_prefix}%0#{w_r}X%0#{w_c}X" % [location.floor, location.row, location.cell]
end