Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: d769d22d8e
Fetching contributors…

Cannot retrieve contributors at this time

26 lines (21 sloc) 0.557 kb
require 'mime/types'
require 'shellwords'
module Wand
Version = '0.2'
def self.wave(path)
type = MIME::Types.type_for(path)[0].to_s
type = execute_file_cmd(path).split(';')[0].strip if type.nil? || type == ''
type = nil if type =~ /cannot\sopen/
type
end
def self.executable
return @executable if defined?(@executable)
@executable ||= `which file`.chomp
end
def self.executable=(path)
@executable = path
end
def self.execute_file_cmd(path)
`#{executable} --mime --brief #{path.shellescape}`
end
end
Jump to Line
Something went wrong with that request. Please try again.