Parent

Methods

Files

Class/Module Index [+]

Quicksearch

Dragonfly::Analysis::FileCommandAnalyser

Public Instance Methods

mime_type(temp_object) click to toggle source
# File lib/dragonfly/analysis/file_command_analyser.rb, line 13
def mime_type(temp_object)
  content_type = if use_filesystem
    `#{file_command} -b --mime #{quote temp_object.path}`
  else
    IO.popen("#{file_command} -b --mime -", 'r+') do |io|
      if num_bytes_to_check
        io.write temp_object.data[0, num_bytes_to_check]
      else
        io.write temp_object.data 
      end
      io.close_write
      io.read
    end
  end.split(';').first
  content_type.strip if content_type
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.