- A
- C
- D
- F
- I
- M
- P
- S
Instance Public methods
as_json(options = {}) Link
Source: show
# File app/models/db/content_file.rb, line 73 def as_json(options = {}) super.as_json(options).merge({ "plan_names" => plan_names.sort, "plan_ids" => plan_ids.sort, "attachment_url" => attachment_url, "content_type" => content_type, "download_url" => attachment ? download_url : nil, "content_link" => content_link }) end
audio?() Link
Source: show
# File app/models/db/content_file.rb, line 57 def audio? mime_type.include? "audio/" end
content_type() Link
Source: show
# File app/models/db/content_file.rb, line 61 def content_type if image? "image" elsif audio? "audio" elsif pdf? "pdf" else "file" end end
document?() Link
Source: show
# File app/models/db/content_file.rb, line 43 def document? %w[msword document].any? { |type| mime_type.include? type } end
file=(input) Link
Source: show
# File app/models/db/content_file.rb, line 21 def file=(input) self.attachment = if input.is_a?(Hash) attachment_from_direct_upload(input) else input end self.file_name = metadata_filename end
filename() Link
Source: show
# File app/models/db/content_file.rb, line 31 def filename file_name || metadata_filename end
image?() Link
Source: show
# File app/models/db/content_file.rb, line 39 def image? mime_type.include? "image/" end
mime_type() Link
Source: show
# File app/models/db/content_file.rb, line 84 def mime_type attachment ? attachment.metadata["mime_type"] : "" end
pdf?() Link
Source: show
# File app/models/db/content_file.rb, line 35 def pdf? mime_type.include? "pdf" end