lib/quandl/format/dataset/attributes.rb in quandl_format-0.2.2 vs lib/quandl/format/dataset/attributes.rb in quandl_format-0.2.3

- old
+ new

@@ -49,11 +49,11 @@ self.source_code = value[0] self.code = value[1] end def full_code - [source_code, code].join('/') + [source_code, code].collect{|v| v.blank? ? nil : v }.compact.join('/') end def description=(value) @description = value.to_s.gsub('\n', "\n") end @@ -63,10 +63,14 @@ self.column_names = @data.headers if @data.headers.present? data_row_count_should_match_column_count! data_rows_should_have_equal_columns! @data end + + def column_names + @column_names ||= [] + end def column_names=(names) @column_names = Array(names).flatten.collect{|n| n.strip.rstrip } end @@ -83,9 +87,10 @@ end protected def data_rows_should_have_equal_columns! + return if data.blank? row_count = data[0].count data.each_with_index do |row, index| raise_row_column_mismatch!(row, index) unless row.count == row_count end end \ No newline at end of file