lib/catissue/domain/abstract_specimen.rb
def infer_class(params)
      opt = params[:specimen_class]
      if opt.nil? then
        rqmt = params[:specimen_requirement]
        opt = rqmt.specimen_class if rqmt
      end
      raise ArgumentError.new("Specimen class is missing from the create parameters") if opt.nil?
      return opt if Class === opt
      # infer the specimen domain class from the specimen_class prefix and Specimen or SpecimenRequirement suffix
      cls_nm = opt.to_s.capitalize_first + 'Specimen'
      cls_nm += 'Requirement' if CaTissue::SpecimenRequirement === self
      CaTissue.const_get(cls_nm)
    end
def infer_class(params)
      opt = params[:specimen_class]
      if opt.nil? then
        rqmt = params[:specimen_requirement]
        opt = rqmt.specimen_class if rqmt
      end
      raise ArgumentError.new("Specimen class is missing from the create parameters") if opt.nil?
      return opt if Class === opt
      # infer the specimen domain class from the specimen_class prefix and Specimen or SpecimenRequirement suffix
      cls_nm = opt.to_s.capitalize_first + 'Specimen'
      cls_nm += 'Requirement' if CaTissue::SpecimenRequirement === self
      CaTissue.const_get(cls_nm)
    end
def infer_class ( params ) opt = params [ :specimen_class ] if opt . nil? then rqmt = params [ :specimen_requirement ] opt = rqmt . specimen_class if rqmt end raise ArgumentError . new ( "Specimen class is missing from the create parameters" ) if opt . nil? return opt if Class === opt # infer the specimen domain class from the specimen_class prefix and Specimen or SpecimenRequirement suffix cls_nm = opt . to_s . capitalize_first + 'Specimen' cls_nm += 'Requirement' if CaTissue :: SpecimenRequirement === self CaTissue . const_get ( cls_nm ) end
Returns the Class from the given params hash.If the +:specimen_class+ parameter
 is set to a Class, then this method returns that Class. Otherwise, if the parameter is a
 String or Symbol, then the Class is formed from the parameter as a prefix and 'Specimen' or
 'SpecimenRequirement' depending on this AbstractSpecimen's subclass. If the
 :specimen_class parameter is missing and there is a +:specimen_requirement+ parameter,
 then the specimen requirement specimen_class attribute value is used.

 @param [{Symbol => Object}] params the specimen attribute => value hash
 @return [Class] the AbstactSpecimen subclass to use
Returns the Class from the given params hash . If the + : specimen_class + parameter is set to a Class then this method returns that Class . Otherwise if the parameter is a String or Symbol then the Class is formed from the parameter as a prefix and Specimen or SpecimenRequirement depending on this AbstractSpecimen s subclass . If the : specimen_class parameter is missing and there is a + : specimen_requirement + parameter then the specimen requirement specimen_class attribute value is used .