Class: File

Inherits:
Object show all
Defined in:
rake_modules/monkey_patch.rb

Overview

Add patch to test file mime type

Class Method Summary collapse

Class Method Details

.mime_type(name) ⇒ Object



44
45
46
# File 'rake_modules/monkey_patch.rb', line 44

def self.mime_type(name)
  `file -b --mime-type '#{name}'`.chomp
end

.text?(name) ⇒ Boolean

Returns:

  • (Boolean)


48
49
50
# File 'rake_modules/monkey_patch.rb', line 48

def self.text?(name)
  mime_type(name).split('/')[0] == 'text'
end