Module: CaTissue::SCGEventParameters

Included in:
CollectionEventParameters, ReceivedEventParameters
Defined in:
lib/catissue/domain/scg_event_parameters.rb,
lib/catissue/migration/shims.rb

Overview

A SCGEventParameters is a SpecimenEventParameters which can be owned by a SpecimenCollectionGroup.

Instance Method Summary collapse

Instance Method Details

#match_in_owner_scope(others) ⇒ Object

Returns the SpecimenEventParameters in others which matches this SCGEventParameters in the scope of an owner Specimen or SCG. This method relaxes CaRuby::Resource#match_in_owner_scope for a SCGEventParameters that matches any SpecimenEventParameters in others of the same class, since there can be at most one SCGEventParameters of a given class for a given SCG.



7
8
9
# File 'lib/catissue/domain/scg_event_parameters.rb', line 7

def match_in_owner_scope(others)
  others.detect { |other| minimal_match?(other) }
end

#migrate_specimen(spc, row) ⇒ Specimen?

Returns the given Specimen spc unless this SCGEventParameters already has a SCG owner. A SCGEventParameters is preferentially set to a migrated SCG rather than a migrated Specimen.

Parameters:

  • spc (Specimen)

    the migrated owner specimen

Returns:

  • (Specimen, nil)

    spc unless there is already a SCG owner



104
105
106
# File 'lib/catissue/migration/shims.rb', line 104

def migrate_specimen(spc, row)
  spc unless specimen_collection_group
end

#migrate_specimen_collection_group(scg, row) ⇒ SpecimenCollectionGroup

Returns scg.

Parameters:

Returns:

See Also:



92
93
94
95
96
# File 'lib/catissue/migration/shims.rb', line 92

def migrate_specimen_collection_group(scg, row)
  # unset the specimen parent if necessary
  self.specimen = nil if specimen and scg
  scg
end