Class: DBF::Database::Table

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, long_names:) ⇒ Table

Returns a new instance of Table.



111
112
113
114
# File 'lib/dbf/database/foxpro.rb', line 111

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.



109
110
111
# File 'lib/dbf/database/foxpro.rb', line 109

def long_names
  @long_names
end

Instance Method Details

#build_columnsObject

:nodoc:



116
117
118
119
120
121
122
123
124
125
# File 'lib/dbf/database/foxpro.rb', line 116

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