lib/dbf/table.rb in dbf-3.0.4 vs lib/dbf/table.rb in dbf-3.0.5
- old
+ new
@@ -37,10 +37,11 @@
'fb' => 'FoxPro without memo file'
}
attr_reader :header
attr_accessor :encoding
+ attr_writer :name
# Opens a DBF::Table
# Examples:
# # working with a file stored on the filesystem
# table = DBF::Table.new 'data.dbf'
@@ -94,10 +95,15 @@
end
end
# @return String
def filename
- File.basename @data.path
+ File.basename @data.path if @data.respond_to?(:path)
+ end
+
+ # @return String
+ def name
+ @name ||= filename && File.basename(filename, ".*")
end
# Calls block once for each record in the table. The record may be nil
# if the record has been marked as deleted.
#