Class: UWDC::Display

Inherits:
Object
  • Object
show all
Defined in:
lib/uwdc/display.rb

Overview

Public: Return an object to drive the display of UWDC items

Example

# => object

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, xml = nil) ⇒ Display

Returns a new instance of Display.



12
13
14
# File 'lib/uwdc/display.rb', line 12

def initialize(id, xml=nil)
  @mets = UWDC::Mets.new(id,xml)
end

Instance Attribute Details

#metsObject

Returns the value of attribute mets.



10
11
12
# File 'lib/uwdc/display.rb', line 10

def mets
  @mets
end

#titleObject

Returns the value of attribute title.



10
11
12
# File 'lib/uwdc/display.rb', line 10

def title
  @title
end

#visual_representationObject

Returns the value of attribute visual_representation.



10
11
12
# File 'lib/uwdc/display.rb', line 10

def visual_representation
  @visual_representation
end

Class Method Details

.cmodelsObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/uwdc/display.rb', line 28

def self.cmodels
  {
    "info:fedora/1711.dl:CModelAudio"                   => { :view => true,   :partial => "audio" },
    "info:fedora/1711.dl:CModelAudioStream"             => { :view => true,   :partial => "audio" },
    "info:fedora/1711.dl:CModelCompositeObject"         => { :view => true,   :partial => "set" },
    "info:fedora/1711.dl:CModelCollection"              => { :view => true,   :partial => "collection" },
    "info:fedora/1711.dl:CModelCompositeObject"         => { :view => false,  :partial => nil },
    "info:fedora/1711.dl:CModelCompositeSequenceObject" => { :view => true,   :partial => "image-with-sequence" },
    "info:fedora/1711.dl:CModelFirstClassObject"        => { :view => false,  :partial => nil },
    "info:fedora/1711.dl:CModelImageWithDefaultRes"     => { :view => true,   :partial => "image" },
    "info:fedora/1711.dl:CModelImageWithDetail"         => { :view => true,   :partial => "image-with-detail" },
    "info:fedora/1711.dl:CModelImageWithSequence"       => { :view => true,   :partial => "image-with-sequence" },
    "info:fedora/1711.dl:CModelImageWithXLarge"         => { :view => true,   :partial => "image-with-xlarge" },
    "info:fedora/1711.dl:CModelImageWithZoom"           => { :view => true,   :partial => "image-with-zoom" },
    "info:fedora/1711.dl:CModelSimpleDocument"          => { :view => true,   :partial => "download" },
    "info:fedora/1711.dl:CModelUWDCObject"              => { :view => false,  :partial => nil }
  }
end

.useObject



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/uwdc/display.rb', line 16

def self.use
  {
    "title"                 => { :view => false,  :partial => "text" },
    "visualrepresentation"  => { :view => false,  :partial => "text" },
    "icon"                  => { :view => true,   :partial => "image" },
    "thumb"                 => { :view => true,   :partial => "image" },
    "reference"             => { :view => true,   :partial => "image" },
    "large"                 => { :view => true,   :partial => "image" },
    "audiostream"           => { :view => true,   :partial => "audio" }
  }
end

Instance Method Details

#audioObject



61
62
63
64
65
66
# File 'lib/uwdc/display.rb', line 61

def audio
  viewable_models.inject({}) do |result, model|
    result[model] = select_files(model, "audio") unless select_files(model, "audio").empty?
    result
  end
end

#filesObject



47
48
49
# File 'lib/uwdc/display.rb', line 47

def files
  @mets.file_sec.files
end

#imagesObject



51
52
53
54
55
56
# File 'lib/uwdc/display.rb', line 51

def images
  viewable_models.inject({}) do |result, model|
    result[model] = select_files(model, "image") unless select_files(model, "image").empty?
    result
  end
end

#modelsObject



82
83
84
# File 'lib/uwdc/display.rb', line 82

def models
  @mets.rels_ext.models
end

#modsObject Also known as: metadata



68
69
70
# File 'lib/uwdc/display.rb', line 68

def mods
  @mets.mods
end

#partialsObject

@TODO: Public: Partials is the intersection of the struct_map and the object cmodels Need to preserve the struct map’s “div” structure But also tease out which objects are displayable via which partials

Return an array of Hashes (possibly nested) of ids keying to view partials



78
79
80
# File 'lib/uwdc/display.rb', line 78

def partials
  @mets.struct_map.structure
end

#videoObject



58
59
# File 'lib/uwdc/display.rb', line 58

def video
end