Class: CaTissue::TransferEventParameters

Inherits:
Object
  • Object
show all
Defined in:
lib/catissue/domain/transfer_event_parameters.rb

Overview

The caTissue TransferEventParameters class is augmented with zero-based from_row, from_column, to_row and to_column methods wrapping the corresponding one-based dimension attributes.

Instance Method Summary collapse

Instance Method Details

#fromObject

Returns the from Location.



17
18
19
# File 'lib/catissue/domain/transfer_event_parameters.rb', line 17

def from
  Location.new(:in => from_container, :at => [from_column, from_row]) if from_container
end

#from=(location) ⇒ Object

Sets the from Location.



22
23
24
25
26
27
28
29
# File 'lib/catissue/domain/transfer_event_parameters.rb', line 22

def from=(location)
  if location then
    self.from_container = location.container
    self.from_row = location.row
    self.from_column = location.column
  end
  location
end

#toObject

Returns the to Location.



34
35
36
# File 'lib/catissue/domain/transfer_event_parameters.rb', line 34

def to
  Location.new(:in => to_container, :at => [to_column, to_row]) if to_container
end

#to=(location) ⇒ Object

Sets the to Location.



39
40
41
42
43
44
# File 'lib/catissue/domain/transfer_event_parameters.rb', line 39

def to=(location)
  if location.nil? then raise ArgumentError.new("Specimen cannot be moved to an empty location") end
  self.to_container = location.container
  self.to_row = location.row
  self.to_column = location.column
end