Magic number based validation for files in Ruby, in pure Ruby.