module Ckeditor::Backend::Paperclip::InstanceMethods

Public Instance Methods

geometry() click to toggle source
# File lib/ckeditor/backend/paperclip.rb, line 21
def geometry
  @geometry ||= ::Paperclip::Geometry.from_file(file)
end

Protected Instance Methods

extract_content_type() click to toggle source
# File lib/ckeditor/backend/paperclip.rb, line 45
def extract_content_type
  path = file.nil? ? nil : file.path
  self.data_content_type = Utils::ContentTypeDetector.new(path).detect
end
file() click to toggle source
# File lib/ckeditor/backend/paperclip.rb, line 27
def file
  @file ||= data.respond_to?(:queued_for_write) ? data.queued_for_write[:original] : data.to_file
end
parameterize_filename() click to toggle source
# File lib/ckeditor/backend/paperclip.rb, line 31
def parameterize_filename
  unless data_file_name.blank?
    filename = Ckeditor::Utils.parameterize_filename(data_file_name)
    self.data.instance_write(:file_name, filename)
  end
end
read_dimensions() click to toggle source
# File lib/ckeditor/backend/paperclip.rb, line 38
def read_dimensions
  if image? && has_dimensions?
    self.width = geometry.width
    self.height = geometry.height
  end
end