Class: Eluvia::FileWrapper

Inherits:
Object show all
Includes:
ActiveModel::Model, ActiveModel::Attributes, ActiveRecord::FileAttribute
Defined in:
lib/eluvia/models/file_wrapper.rb

Constant Summary

Constants included from ActiveModel::Attributes

ActiveModel::Attributes::COMPLEX_TYPES, ActiveModel::Attributes::SIMPLE_TYPES

Instance Method Summary collapse

Methods included from ActiveModel::Attributes

#initialize, #new_record?, #read_attribute, #write_attribute

Instance Method Details

#filenameObject



33
34
35
# File 'lib/eluvia/models/file_wrapper.rb', line 33

def filename
  file&.filename
end

#idObject



15
16
17
# File 'lib/eluvia/models/file_wrapper.rb', line 15

def id
  @id ||= (self.url ? Eluvia::Uuid.str_to_uuid("File-#{self.url}") : nil)
end

#typeObject



21
22
23
# File 'lib/eluvia/models/file_wrapper.rb', line 21

def type
  file&.type
end

#urlObject



27
28
29
# File 'lib/eluvia/models/file_wrapper.rb', line 27

def url
  file&.url
end