Class: File

Inherits:
Object
  • Object
show all
Defined in:
lib/common/hacks.rb

Class Method Summary (collapse)

Class Method Details

+ (String) charset(file_path)

The charset of the file

Parameters:

  • file_path (String)

Returns:

  • (String)

    The charset of the file



78
79
80
# File 'lib/common/hacks.rb', line 78

def self.charset(file_path)
  %x{file --mime #{file_path}}[%r{charset=([^\n]+)\n}, 1]
end