Class: Accession::Tag

Inherits:
Object
  • Object
show all
Includes:
Equality, 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.

Constant Summary collapse

DEFAULT_ATTRIBUTES =
{ services: [] }

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Equality

#<=>, #to_a

Constructor Details

#initialize(attributes = {}) ⇒ Tag

Returns a new instance of Tag


16
17
18
# File 'lib/accession/accession/tag.rb', line 16

def initialize(attributes = {})
  super(DEFAULT_ATTRIBUTES.merge(attributes))
end

Instance Attribute Details

#ebi_nameObject

Returns the value of attribute ebi_name


10
11
12
# File 'lib/accession/accession/tag.rb', line 10

def ebi_name
  @ebi_name
end

#groupsObject

Returns the value of attribute groups


10
11
12
# File 'lib/accession/accession/tag.rb', line 10

def groups
  @groups
end

#nameObject

Returns the value of attribute name


10
11
12
# File 'lib/accession/accession/tag.rb', line 10

def name
  @name
end

#servicesObject

Returns the value of attribute services


10
11
12
# File 'lib/accession/accession/tag.rb', line 10

def services
  @services
end

#valueObject

Returns the value of attribute value


10
11
12
# File 'lib/accession/accession/tag.rb', line 10

def value
  @value
end

Instance Method Details

#add_value(value) ⇒ Object


44
45
46
47
# File 'lib/accession/accession/tag.rb', line 44

def add_value(value)
  self.value = value
  self
end

#array_express?Boolean

Returns:

  • (Boolean)

32
33
34
# File 'lib/accession/accession/tag.rb', line 32

def array_express?
  array_express
end

#array_express_labelObject


53
54
55
# File 'lib/accession/accession/tag.rb', line 53

def array_express_label
  "ArrayExpress-#{label}"
end

#attributesObject


57
58
59
# File 'lib/accession/accession/tag.rb', line 57

def attributes
  [:services, :value, :name, :groups, :ebi_name]
end

#labelObject


49
50
51
# File 'lib/accession/accession/tag.rb', line 49

def label
  (ebi_name || name).to_s.upcase
end

#required_for?(service) ⇒ Boolean

Returns:

  • (Boolean)

28
29
30
# File 'lib/accession/accession/tag.rb', line 28

def required_for?(service)
  services.include? service.provider
end

#sample_attributes?Boolean

Returns:

  • (Boolean)

40
41
42
# File 'lib/accession/accession/tag.rb', line 40

def sample_attributes?
  sample_attributes
end

#sample_name?Boolean

Returns:

  • (Boolean)

36
37
38
# File 'lib/accession/accession/tag.rb', line 36

def sample_name?
  sample_name
end