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.



61
62
63
64
65
# File 'app/models/arclight/document_downloads.rb', line 61

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

Instance Attribute Details

#documentObject (readonly)

Returns the value of attribute document.



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

def document
  @document
end

#typeObject (readonly)

Returns the value of attribute type.



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

def type
  @type
end

Instance Method Details

#hrefObject



67
68
69
70
71
# File 'app/models/arclight/document_downloads.rb', line 67

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

  format_template
end

#sizeObject



73
74
75
76
77
# File 'app/models/arclight/document_downloads.rb', line 73

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

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