lib/catissue/domain/specimen.rb
def merge_attributes(other, attributes=nil, matches=nil, &filter)
      case other
      when SpecimenRequirement then
        # merge with the default requirement merge attributes if necessary
        attributes ||= MERGEABLE_RQMT_ATTRS
        super(other, attributes)
        # copy the requirement characteristics
        sc = other.specimen_characteristics
        self.specimen_characteristics ||= sc.copy(MERGEABLE_SPC_CHR_ATTRS) if sc
      when Jinx::Hasher then
        # the requirement template
        rqmt = other[:specimen_requirement] || other[:requirement]
        # merge the attribute => value hash
        super
        # merge the SpecimenRequirement after the hash
        merge_attributes(rqmt) if rqmt
      else super
      end
      self
    end
def merge_attributes(other, attributes=nil, matches=nil, &filter)
      case other
      when SpecimenRequirement then
        # merge with the default requirement merge attributes if necessary
        attributes ||= MERGEABLE_RQMT_ATTRS
        super(other, attributes)
        # copy the requirement characteristics
        sc = other.specimen_characteristics
        self.specimen_characteristics ||= sc.copy(MERGEABLE_SPC_CHR_ATTRS) if sc
      when Jinx::Hasher then
        # the requirement template
        rqmt = other[:specimen_requirement] || other[:requirement]
        # merge the attribute => value hash
        super
        # merge the SpecimenRequirement after the hash
        merge_attributes(rqmt) if rqmt
      else super
      end
      self
    end
def merge_attributes ( other , attributes = nil , matches = nil , & filter ) case other when SpecimenRequirement then # merge with the default requirement merge attributes if necessary attributes ||= MERGEABLE_RQMT_ATTRS super ( other , attributes ) # copy the requirement characteristics sc = other . specimen_characteristics self . specimen_characteristics ||= sc . copy ( MERGEABLE_SPC_CHR_ATTRS ) if sc when Jinx :: Hasher then # the requirement template rqmt = other [ :specimen_requirement ] || other [ :requirement ] # merge the attribute => value hash super # merge the SpecimenRequirement after the hash merge_attributes ( rqmt ) if rqmt else super end self end
# Restores this disposed Specimen by deleting the DisposalEventParameters and resetting the availability and activity status.
    # Returns the deleted DisposalEventParameters, or nil if none.
    def recover
      # TODO - test this
      dep = event_parameters.detect { |ep| CaTissue::DisposalEventParameters === ep }
      return if dep.nil?
      dep.delete
      self.available = true
      self.activity_status = 'Active'
      update
    end
 Override default +Jinx::Resource.merge_attributes+ to ignore a source SpecimenRequirement parent_specimen.
# Restores this disposed Specimen by deleting the DisposalEventParameters and resetting the availability and activity status . # Returns the deleted DisposalEventParameters or nil if none . def recover # TODO - test this dep = event_parameters . detect { |ep| CaTissue :: DisposalEventParameters === ep } return if dep . nil? dep . delete self . available = true self . activity_status = Active update end Override default + Jinx :: Resource . merge_attributes + to ignore a source SpecimenRequirement parent_specimen .