lib/simple_csv/reader.rb in simple_csv-0.2.0 vs lib/simple_csv/reader.rb in simple_csv-0.2.1

- old
+ new

@@ -68,13 +68,17 @@ def first_line @first_line ||= File.open @csv_path, &:readline end + def respond_to_missing?(mtd, include_private) + headers.include?(m) || @col_map.key?(m) + end + def method_missing(mtd, *args, &block) m = mtd.to_s return @record[m] if headers.include?(m) - return @record[@col_map[m]] if @col_map[m] + return @record[@col_map[m]] if @col_map.key?(m) super end end end