class Dire::File
Public Instance Methods
binary?()
click to toggle source
# File lib/dire/file.rb, line 5 def binary? return @binary if @binary if mime && !['application', 'text'].include?(mime.mediatype) return @binary = true end @binary = !absolute_path.read.valid_encoding? rescue true end
mime()
click to toggle source
# File lib/dire/file.rb, line 15 def mime @mime ||= MimeMagic.by_magic absolute_path.open end
text?()
click to toggle source
# File lib/dire/file.rb, line 19 def text? !binary? end
validate!()
click to toggle source
Calls superclass method
# File lib/dire/file.rb, line 23 def validate! super && validate_type!('file') end