Class: ArchivalRecordChildren

Inherits:
JSONModel
  • Object
show all
Includes:
RecordChildren
Defined in:
frontend/app/models/archival_record_children.rb

Direct Known Subclasses

ArchivalObjectChildren, ResourceChildren

Instance Attribute Summary collapse

Class Method Summary collapse

Methods included from RecordChildren

#child_type, included

Instance Attribute Details

#uriObject

Returns the value of attribute uri



8
9
10
# File 'frontend/app/models/archival_record_children.rb', line 8

def uri
  @uri
end

Class Method Details

.clean(child) ⇒ Object



15
16
17
18
# File 'frontend/app/models/archival_record_children.rb', line 15

def self.clean(child)
  super
  clean_instances(child)
end

.clean_instances(child) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'frontend/app/models/archival_record_children.rb', line 21

def self.clean_instances(child)
  return if !child["instances"] || child["instances"].empty?

  child["instances"] = [child["instances"].first]

  if child["instances"][0]["sub_container"].reject {|k, v| v.blank?}.empty?
    child["instances"][0].delete("sub_container")
  end

  if !child["instances"][0].has_key?("sub_container") && child["instances"][0]["instance_type"].blank?
    child["instances"] = []
  end
end

.uri_for(*args) ⇒ Object



10
11
12
# File 'frontend/app/models/archival_record_children.rb', line 10

def self.uri_for(*args)
  nil
end