Class: DBF::Database::Table

Inherits:
Table
  • Object
show all
Defined in:
lib/dbf/database/foxpro.rb

Constant Summary

Constants included from Schema

Schema::FORMATS, Schema::OTHER_DATA_TYPES, Schema::STRING_DATA_FORMATS

Instance Attribute Summary collapse

Attributes inherited from Table

#encoding

Instance Method Summary collapse

Methods inherited from Table

#close, #closed?, #column_names, #column_offsets, #columns, #each, #encode_string, #filename, #has_memo_file?, #header_encoding, #name, #record, #record_context, #to_csv, #version_description

Methods included from Find

#find

Methods included from Schema

#activerecord_schema, #activerecord_schema_definition, #json_schema, #number_data_type, #schema, #schema_data_type, #schema_name, #sequel_schema, #sequel_schema_definition, #string_data_format

Constructor Details

#initialize(path, long_names:) ⇒ Table

Returns a new instance of Table.



97
98
99
100
# File 'lib/dbf/database/foxpro.rb', line 97

def initialize(path, long_names:)
  @long_names = long_names
  super(path)
end

Instance Attribute Details

#long_namesObject (readonly)

Returns the value of attribute long_names.



95
96
97
# File 'lib/dbf/database/foxpro.rb', line 95

def long_names
  @long_names
end

Instance Method Details

#build_columnsObject

:nodoc:



102
103
104
105
106
107
108
109
110
111
# File 'lib/dbf/database/foxpro.rb', line 102

def build_columns # :nodoc:
  columns = super

  # modify the column definitions to use the long names as the
  # columnname property is readonly, recreate the column definitions
  columns.map do |column|
    long_name = long_names[columns.index(column)]
    Column.new(self, long_name, column.type, column.length, column.decimal)
  end
end