Class: Robot::PickData

Inherits:
Object
  • Object
show all
Defined in:
app/models/robot/pick_data.rb

Overview

Builds the information about a cherrypick for a Batch

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(batch, user: batch.user, max_beds: nil) ⇒ PickData

Create a pick data object

Parameters:

  • batch (Batch)

    The batch being picked

  • user (User) (defaults to: batch.user)

    The user generating the file (defaults to batch owner)

  • max_beds (Integer) (defaults to: nil)

    The maximum number of source plates in any one pick


16
17
18
19
20
21
# File 'app/models/robot/pick_data.rb', line 16

def initialize(batch, user: batch.user, max_beds: nil)
  @batch = batch
  @user = user
  @max_beds = max_beds
  @picking_data_hash ||= Hash.new { |hash, barcode| hash[barcode] = generate_picking_data_hash(barcode) }
end

Instance Attribute Details

#batchObject (readonly)

Returns the value of attribute batch


5
6
7
# File 'app/models/robot/pick_data.rb', line 5

def batch
  @batch
end

#userObject (readonly)

Returns the value of attribute user


5
6
7
# File 'app/models/robot/pick_data.rb', line 5

def user
  @user
end

Instance Method Details

#picking_data_hash(target_barcode) ⇒ Object


23
24
25
# File 'app/models/robot/pick_data.rb', line 23

def picking_data_hash(target_barcode)
  @picking_data_hash[target_barcode]
end