Class: Arclight::DocumentDownloads::File

Inherits:
Object
  • Object
show all
Defined in:
app/models/arclight/document_downloads.rb

Overview

Model a single file configured in downloads.yml

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, data:, document:) ⇒ File

Returns a new instance of File.



58
59
60
61
62
# File 'app/models/arclight/document_downloads.rb', line 58

def initialize(type:, data:, document:)
  @type = type
  @data = data
  @document = document
end

Instance Attribute Details

#documentObject (readonly)

Returns the value of attribute document.



56
57
58
# File 'app/models/arclight/document_downloads.rb', line 56

def document
  @document
end

#typeObject (readonly)

Returns the value of attribute type.



56
57
58
# File 'app/models/arclight/document_downloads.rb', line 56

def type
  @type
end

Instance Method Details

#hrefObject



64
65
66
67
68
# File 'app/models/arclight/document_downloads.rb', line 64

def href
  return data['href'] if data['href']

  format_template
end

#sizeObject



70
71
72
73
74
# File 'app/models/arclight/document_downloads.rb', line 70

def size
  return data['size'] if data['size']

  document.public_send(data['size_accessor'].to_sym) if data['size_accessor']
end