Class: Accession::TagCollectionDate
- Defined in:
- lib/accession/accession/tag.rb
Overview
Value serialization for collection date in accessioning XML generation It will return a valid collection date or ‘not collected’ if nothing provided or invalid It also allow other config settings for the XML service like the list defined inside OTHER_DEFAULT_SETTINGS NB: this regexp is defined in www.ebi.ac.uk/ena/browser/api/xml/ERC000011
Constant Summary collapse
- REGEXP =
rubocop:disable Layout/LineLength
%r{(^[12][0-9]{3}(-(0[1-9]|1[0-2])(-(0[1-9]|[12][0-9]|3[01])(T[0-9]{2}:[0-9]{2}(:[0-9]{2})?Z?([+-][0-9]{1,2})?)?)?)?(/[0-9]{4}(-[0-9]{2}(-[0-9]{2}(T[0-9]{2}:[0-9]{2}(:[0-9]{2})?Z?([+-][0-9]{1,2})?)?)?)?)?$)}
Constants inherited from Tag
Accession::Tag::DEFAULT_ATTRIBUTES
Constants included from Accession::Tag::HelperTagValue
Accession::Tag::HelperTagValue::MISING_THIRD_PARTY_DATA, Accession::Tag::HelperTagValue::MISSING_CONTROL_SAMPLE, Accession::Tag::HelperTagValue::MISSING_DATA_AGGREEMENT_PRE2023, Accession::Tag::HelperTagValue::MISSING_ENDANGERED_SPECIES, Accession::Tag::HelperTagValue::MISSING_HUMAN_IDENTIFIABLE, Accession::Tag::HelperTagValue::MISSING_LAB_STOCK, Accession::Tag::HelperTagValue::MISSING_SAMPLE_GROUP, Accession::Tag::HelperTagValue::MISSING_SYNTHETIC_CONSTRUCT, Accession::Tag::HelperTagValue::NOT_APPLICABLE_CONTROL_SAMPLE, Accession::Tag::HelperTagValue::NOT_APPLICABLE_SAMPLE_GROUP, Accession::Tag::HelperTagValue::NOT_COLLECTED, Accession::Tag::HelperTagValue::NOT_PROVIDED, Accession::Tag::HelperTagValue::OTHER_DEFAULT_SETTINGS, Accession::Tag::HelperTagValue::RESTRICTED_ACCESS
Instance Attribute Summary
Attributes inherited from Tag
#class_name, #ebi_name, #groups, #name, #services, #value
Instance Method Summary collapse
-
#value_for(record, key) ⇒ Object
rubocop:enable Layout/LineLength.
Methods inherited from Tag
#add_value, #array_express?, #array_express_label, #attributes, #initialize, #label, #required_for?, #sample_attributes?, #sample_name?
Methods included from Accession::Tag::HelperTagValue
Methods included from Equality
Constructor Details
This class inherits a constructor from Accession::Tag
Instance Method Details
#value_for(record, key) ⇒ Object
rubocop:enable Layout/LineLength
128 129 130 131 132 133 |
# File 'lib/accession/accession/tag.rb', line 128 def value_for(record, key) val = record.send(key) return val if OTHER_DEFAULT_SETTINGS.include?(val) return incorrect_format_value unless REGEXP.match?(val) val end |