Module: Pageflow::HostedFile

Extended by:
ActiveSupport::Concern
Includes:
UploadedFile
Included in:
AudioFile, ImageFile, 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, #direct_upload_config, #file_type, #nested_files, #parent_allows_type_for_nesting, #parent_belongs_to_same_entry

Instance Method Details

#attachmentObject



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

def attachment
  attachment_on_s3
end

#attachment=(value) ⇒ Object



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

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

#attachment_default_urlObject



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

def attachment_default_url
  ''
end

#attachment_styles(_attachment) ⇒ Object



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

def attachment_styles(_attachment)
  {}
end

#basenameObject



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

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

#can_upload?Boolean

Returns:

  • (Boolean)


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

def can_upload?
  uploading?
end

#original_urlObject



79
80
81
# File 'app/models/concerns/pageflow/hosted_file.rb', line 79

def original_url
  url
end

#ready?Boolean

Returns:

  • (Boolean)


65
66
67
# File 'app/models/concerns/pageflow/hosted_file.rb', line 65

def ready?
  attachment.present?
end

#retryable?Boolean

Returns:

  • (Boolean)


61
62
63
# File 'app/models/concerns/pageflow/hosted_file.rb', line 61

def retryable?
  false
end

#urlObject



73
74
75
76
77
# File 'app/models/concerns/pageflow/hosted_file.rb', line 73

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