Module: Pageflow::HostedFile

Extended by:
ActiveSupport::Concern
Includes:
UploadedFile
Included in:
AudioFile, TextTrackFile, VideoFile
Defined in:
app/models/concerns/pageflow/hosted_file.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Methods included from UploadedFile

#cache_key, #file_type, #nested_files, #parent_allows_type_for_nesting, #parent_belongs_to_same_entry

Instance Method Details

#attachmentObject



42
43
44
# File 'app/models/concerns/pageflow/hosted_file.rb', line 42

def attachment
  attachment_on_s3.present? ? attachment_on_s3 : attachment_on_filesystem
end

#attachment=(value) ⇒ Object



46
47
48
# File 'app/models/concerns/pageflow/hosted_file.rb', line 46

def attachment=(value)
  self.attachment_on_filesystem = value
end

#basenameObject



58
59
60
# File 'app/models/concerns/pageflow/hosted_file.rb', line 58

def basename
  File.basename(attachment.original_filename, '.*')
end

#original_urlObject



68
69
70
# File 'app/models/concerns/pageflow/hosted_file.rb', line 68

def original_url
  url
end

#ready?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'app/models/concerns/pageflow/hosted_file.rb', line 54

def ready?
  attachment_on_s3.present?
end

#retryable?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'app/models/concerns/pageflow/hosted_file.rb', line 50

def retryable?
  can_retry?
end

#urlObject



62
63
64
65
66
# File 'app/models/concerns/pageflow/hosted_file.rb', line 62

def url
  if attachment_on_s3.present?
    attachment.url
  end
end