class DataFile::Detector
Attributes
file[R]
Public Class Methods
new(file)
click to toggle source
# File lib/data_file/detector.rb, line 7 def initialize(file) @file = file end
Public Instance Methods
encoding()
click to toggle source
# File lib/data_file/detector.rb, line 15 def encoding file.external_encoding.name end
mime_type()
click to toggle source
# File lib/data_file/detector.rb, line 19 def mime_type MIME::Types.type_for(file.path).first.content_type end
text?()
click to toggle source
# File lib/data_file/detector.rb, line 11 def text? mime_type =~ /text\/(plain|csv|comma-separated-values)/ end