lib/dbf/table.rb in dbf-1.7.8 vs lib/dbf/table.rb in dbf-2.0.0
- old
+ new
@@ -64,14 +64,23 @@
# Closes the table and memo file
#
# @return [TrueClass, FalseClass]
def close
+ @data.close
@memo && @memo.close
- @data.close && @data.closed?
end
+ # @return [TrueClass, FalseClass]
+ def closed?
+ if @memo
+ @data.closed? && @memo.closed?
+ else
+ @data.closed?
+ end
+ end
+
# @return String
def filename
File.basename @data.path
end
@@ -270,11 +279,11 @@
end
def get_header_info #nodoc
@data.rewind
@version, @record_count, @header_length, @record_length, @encoding_key = read_header
- @encoding = self.class.encodings[@encoding_key] if supports_encoding?
+ @encoding = ENCODINGS[@encoding_key] if supports_encoding?
end
def read_header #nodoc
@data.read(DBF_HEADER_SIZE).unpack("H2 x3 V v2 x17H2")
end
@@ -283,13 +292,9 @@
@data.seek @header_length + offset
end
def csv_class #nodoc
@csv_class ||= CSV.const_defined?(:Reader) ? FCSV : CSV
- end
-
- def self.encodings #nodoc
- @encodings ||= YAML.load_file File.expand_path("../encodings.yml", __FILE__)
end
end
end