Class: Mspire::Mzml::ReferenceableParamGroup

Inherits:
Object
  • Object
show all
Includes:
Paramable
Defined in:
lib/mspire/mzml/referenceable_param_group.rb

Overview

need to call to_xml_definition (or use Mspire::Mzml::ReferenceableParamGroupList.list_xml) to get the xml for the object itself (and not a reference). Merely callying #to_xml will result in a referenceableParamGroupRef being created.

Instance Attribute Summary collapse

Attributes included from Paramable

#cv_params, #ref_param_groups, #user_params

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Paramable

#accessionable_params, #describe!, #describe_from_xml!, #describe_many!, #describe_self_from_xml!, #each_accessionable_param, #each_param, #fetch, #fetch_by_accession, #param?, #param_by_accession, #params, #params?, #reject!, #replace!, #replace_many!

Constructor Details

#initialize(id) {|_self| ... } ⇒ ReferenceableParamGroup

Returns a new instance of ReferenceableParamGroup.

Yields:

  • (_self)

Yield Parameters:



15
16
17
18
19
# File 'lib/mspire/mzml/referenceable_param_group.rb', line 15

def initialize(id)
  @id = id
  params_init
  yield(self) if block_given?
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



13
14
15
# File 'lib/mspire/mzml/referenceable_param_group.rb', line 13

def id
  @id
end

Class Method Details

.from_xml(xml) ⇒ Object



33
34
35
36
37
# File 'lib/mspire/mzml/referenceable_param_group.rb', line 33

def self.from_xml(xml)
  obj = self.new(xml[:id])
  obj.describe_from_xml!(xml)
  obj
end

.list_xml(objs, builder) ⇒ Object



39
40
41
42
43
44
# File 'lib/mspire/mzml/referenceable_param_group.rb', line 39

def self.list_xml(objs, builder)
  builder.referenceableParamGroupList(count: objs.size) do |rpgl_n|
    objs.each {|obj| obj.to_xml_definition(rpgl_n) }
  end
  builder
end

Instance Method Details

#to_xml(builder) ⇒ Object



21
22
23
24
# File 'lib/mspire/mzml/referenceable_param_group.rb', line 21

def to_xml(builder)
  builder.referenceableParamGroupRef(ref: @id)
  builder
end

#to_xml_definition(builder) ⇒ Object



26
27
28
29
30
31
# File 'lib/mspire/mzml/referenceable_param_group.rb', line 26

def to_xml_definition(builder)
  builder.referenceableParamGroup(id: @id) do |fc_n|
    params.each {|obj| obj.to_xml(fc_n) }
  end
  builder
end