Class: Column

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

Constant Summary

Constants included from MDBTools

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

Instance Attribute Summary collapse

Class Method 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(name, type, size) ⇒ Column

Returns a new instance of Column.



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

def initialize(name, type, size)
  @name = name
  @method_name, @type, @size = methodize(name), methodize(type), size.to_i
end

Instance Attribute Details

#method_nameObject (readonly)

Returns the value of attribute method_name.



4
5
6
# File 'lib/active_mdb/column.rb', line 4

def method_name
  @method_name
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/active_mdb/column.rb', line 4

def name
  @name
end

#sizeObject (readonly)

Returns the value of attribute size.



4
5
6
# File 'lib/active_mdb/column.rb', line 4

def size
  @size
end

#typeObject (readonly)

Returns the value of attribute type.



4
5
6
# File 'lib/active_mdb/column.rb', line 4

def type
  @type
end

Class Method Details

.new_from_describe(describe_hash) ⇒ Object



11
12
13
# File 'lib/active_mdb/column.rb', line 11

def self.new_from_describe(describe_hash)
  self.new(describe_hash["Column Name"], describe_hash["Type"], describe_hash["Size"])
end

Instance Method Details

#boolean?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/active_mdb/column.rb', line 16

def boolean?
  self.type == 'boolean'
end