Class: MDB

Inherits:
Object
  • Object
show all
Includes:
MDBTools
Defined in:
lib/active_mdb/mdb.rb

Overview

require ‘mdb_tools’

Constant Summary

Constants included from MDBTools

MDBTools::BACKENDS, MDBTools::DELIMITER, MDBTools::LINEBREAK, MDBTools::SANITIZER

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from MDBTools

#arrays_to_hashes, #backends, #check_file, #check_table, #compile_conditions, #delimited_to_arrays, #describe_table, #mdb_export, #mdb_schema, #mdb_sql, #mdb_tables, #mdb_truth, #methodize, #sanitize!, #sql_select, #table_to_csv

Constructor Details

#initialize(mdb_file, options = {}) ⇒ MDB

Returns a new instance of MDB.



8
9
10
11
12
13
14
15
# File 'lib/active_mdb/mdb.rb', line 8

def initialize(mdb_file, options = {})
  @mdb_file = check_file(mdb_file)
  @prefix = options[:prefix] || ''
  @exclude, @include = options[:exclude], options[:include]
  @export_syntax = options[:sql_syntax] || 'mysql'
  @table_names = mdb_tables(@mdb_file, :exclude => @exclude, :include => @include)
  @tables = create_table_objects
end

Instance Attribute Details

#excludeObject (readonly)

Returns the value of attribute exclude.



6
7
8
# File 'lib/active_mdb/mdb.rb', line 6

def exclude
  @exclude
end

#mdb_fileObject (readonly)

Returns the value of attribute mdb_file.



6
7
8
# File 'lib/active_mdb/mdb.rb', line 6

def mdb_file
  @mdb_file
end

#prefixObject (readonly)

Returns the value of attribute prefix.



6
7
8
# File 'lib/active_mdb/mdb.rb', line 6

def prefix
  @prefix
end

#table_namesObject (readonly)

Returns the value of attribute table_names.



6
7
8
# File 'lib/active_mdb/mdb.rb', line 6

def table_names
  @table_names
end

Instance Method Details

#tablesObject



17
18
19
# File 'lib/active_mdb/mdb.rb', line 17

def tables
  @table_names.collect { |table| methodize(table)}
end