class Construqt::Racks::Rack

Attributes

description[RW]
location[RW]
name[RW]
pin[RW]
total_high[RW]

Public Class Methods

new(name) click to toggle source
# File lib/construqt/rack.rb, line 19
def initialize(name)
  @name = name
  @entries = {}
end

Public Instance Methods

add_entry(positions, key) click to toggle source
# File lib/construqt/rack.rb, line 23
def add_entry(positions, key)
  if /[^0-9]+/.match(position.to_s) && 0 <= position.to_i && position.to_i <= total_high.to_i
    throw "position must be between 0 <= #{total_high} #{position}"
  end
  @entries[position] ||= {}
  throw "entry with key exists #{key} in Rack #{name}" if @entries[position][key]
  entry = Entry.new(key, self)
  @entries[position][key] = entry
  entry
end