lib/csv2hash/adapters/csv_adapter.rb in csv2hash-0.7.6 vs lib/csv2hash/adapters/csv_adapter.rb in csv2hash-0.7.7
- old
+ new
@@ -11,10 +11,17 @@
def initialize file_path
self.file_path = file_path
end
def source
+ check_file!
CSV.read self.file_path
+ end
+
+ private
+
+ def check_file!
+ raise ::Csv2hash::InvalidFile unless File.extname(self.file_path) =~ /csv/i
end
end
end
end