lib/catissue/domain/collection_protocol.rb
def add_specimens(*args)
      hash = args.pop
      spcs = args
      # validate arguments
      unless Hash === hash then
        raise ArgumentError.new("Collection parameters are missing when adding specimens to protocol #{self}")
      end
      # Make the default registration, if necessary.
      unless hash.has_key?(:registration) || hash.has_key?(:collection_protocol_registration) then
        # the participant
        pnt = hash.delete(:participant)
        unless pnt then
          raise ArgumentError.new("Registration or participant missing from collection parameters: #{hash.qp}")
        end
        hash[:registration] = registration(pnt) || make_cpr(pnt)
      end
      # the new SCG
      scg = SpecimenCollectionGroup.new(hash)
      # set each Specimen SCG
      spcs.each { |spc| spc.specimen_collection_group = scg }
      scg
    end
def add_specimens(*args)
      hash = args.pop
      spcs = args
      # validate arguments
      unless Hash === hash then
        raise ArgumentError.new("Collection parameters are missing when adding specimens to protocol #{self}")
      end
      # Make the default registration, if necessary.
      unless hash.has_key?(:registration) || hash.has_key?(:collection_protocol_registration) then
        # the participant
        pnt = hash.delete(:participant)
        unless pnt then
          raise ArgumentError.new("Registration or participant missing from collection parameters: #{hash.qp}")
        end
        hash[:registration] = registration(pnt) || make_cpr(pnt)
      end
      # the new SCG
      scg = SpecimenCollectionGroup.new(hash)
      # set each Specimen SCG
      spcs.each { |spc| spc.specimen_collection_group = scg }
      scg
    end
Adds specimens to this protocol. The argumentes includes the
 specimens to add followed by a Hash with parameters and options.
 If the SCG registration parameter is not set, then a default registration
 is created which registers the given participant to this protocol.

 @example
   protocol.add_specimens(tumor, normal, :participant => pnt, :collector => srg)
   #=> a new SCG for the given participant with a matched pair of samples
   #=> collected by the given surgeon.

 @param [(<Specimen>, {Symbol => Object})] args the specimens to add followed
   by the parameters and options hash
 @option args [CaTissue::Participant] :participant the person from whom the
   specimen is collected
 @return [CaTissue::SpecimenCollectionGroup] the new SCG
 @raise [ArgumentError] if the options do not include either a participant or a registration