Class: Accession::Tag
- Inherits:
-
Object
- Object
- Accession::Tag
- Includes:
- Equality, HelperTagValue, ActiveModel::Model
- Defined in:
- lib/accession/accession/tag.rb
Overview
A tag relates to a sample attribute. It provides all of the relevant information for that attribute i.e. which service it is required for and which groups it will be assigned to in the xml.
Direct Known Subclasses
Defined Under Namespace
Modules: HelperTagValue
Constant Summary collapse
- DEFAULT_ATTRIBUTES =
{ services: [] }.freeze
Constants included from HelperTagValue
HelperTagValue::MISING_THIRD_PARTY_DATA, HelperTagValue::MISSING_CONTROL_SAMPLE, HelperTagValue::MISSING_DATA_AGGREEMENT_PRE2023, HelperTagValue::MISSING_ENDANGERED_SPECIES, HelperTagValue::MISSING_HUMAN_IDENTIFIABLE, HelperTagValue::MISSING_LAB_STOCK, HelperTagValue::MISSING_SAMPLE_GROUP, HelperTagValue::MISSING_SYNTHETIC_CONSTRUCT, HelperTagValue::NOT_APPLICABLE_CONTROL_SAMPLE, HelperTagValue::NOT_APPLICABLE_SAMPLE_GROUP, HelperTagValue::NOT_COLLECTED, HelperTagValue::NOT_PROVIDED, HelperTagValue::OTHER_DEFAULT_SETTINGS, HelperTagValue::RESTRICTED_ACCESS
Instance Attribute Summary collapse
-
#class_name ⇒ Object
Returns the value of attribute class_name.
-
#ebi_name ⇒ Object
Returns the value of attribute ebi_name.
-
#groups ⇒ Object
Returns the value of attribute groups.
-
#name ⇒ Object
Returns the value of attribute name.
-
#services ⇒ Object
Returns the value of attribute services.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #add_value(value) ⇒ Object
- #array_express? ⇒ Boolean
- #array_express_label ⇒ Object
- #attributes ⇒ Object
-
#initialize(attributes = {}) ⇒ Tag
constructor
A new instance of Tag.
- #label ⇒ Object
- #required_for?(service) ⇒ Boolean
- #sample_attributes? ⇒ Boolean
- #sample_name? ⇒ Boolean
Methods included from HelperTagValue
#incorrect_format_value, #value_for
Methods included from Equality
Constructor Details
#initialize(attributes = {}) ⇒ Tag
Returns a new instance of Tag.
17 18 19 |
# File 'lib/accession/accession/tag.rb', line 17 def initialize(attributes = {}) super(DEFAULT_ATTRIBUTES.merge(attributes)) end |
Instance Attribute Details
#class_name ⇒ Object
Returns the value of attribute class_name.
11 12 13 |
# File 'lib/accession/accession/tag.rb', line 11 def class_name @class_name end |
#ebi_name ⇒ Object
Returns the value of attribute ebi_name.
11 12 13 |
# File 'lib/accession/accession/tag.rb', line 11 def ebi_name @ebi_name end |
#groups ⇒ Object
Returns the value of attribute groups.
11 12 13 |
# File 'lib/accession/accession/tag.rb', line 11 def groups @groups end |
#name ⇒ Object
Returns the value of attribute name.
11 12 13 |
# File 'lib/accession/accession/tag.rb', line 11 def name @name end |
#services ⇒ Object
Returns the value of attribute services.
11 12 13 |
# File 'lib/accession/accession/tag.rb', line 11 def services @services end |
#value ⇒ Object
Returns the value of attribute value.
11 12 13 |
# File 'lib/accession/accession/tag.rb', line 11 def value @value end |
Instance Method Details
#add_value(value) ⇒ Object
45 46 47 48 |
# File 'lib/accession/accession/tag.rb', line 45 def add_value(value) self.value = value self end |
#array_express? ⇒ Boolean
33 34 35 |
# File 'lib/accession/accession/tag.rb', line 33 def array_express? array_express end |
#array_express_label ⇒ Object
54 55 56 |
# File 'lib/accession/accession/tag.rb', line 54 def array_express_label "ArrayExpress-#{label}" end |
#attributes ⇒ Object
58 59 60 |
# File 'lib/accession/accession/tag.rb', line 58 def attributes %i[services value name groups ebi_name] end |
#label ⇒ Object
50 51 52 |
# File 'lib/accession/accession/tag.rb', line 50 def label (ebi_name || name).to_s.upcase end |
#required_for?(service) ⇒ Boolean
29 30 31 |
# File 'lib/accession/accession/tag.rb', line 29 def required_for?(service) services.include? service.provider end |
#sample_attributes? ⇒ Boolean
41 42 43 |
# File 'lib/accession/accession/tag.rb', line 41 def sample_attributes? sample_attributes end |
#sample_name? ⇒ Boolean
37 38 39 |
# File 'lib/accession/accession/tag.rb', line 37 def sample_name? sample_name end |