Class: Record

Inherits:
Object
  • Object
show all
Includes:
Enumerable, MDBTools
Defined in:
lib/active_mdb/record.rb

Overview

Deprecated way more than Table

Constant Summary

Constants included from MDBTools

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

Instance Method Summary collapse

Methods included from MDBTools

#arrays_to_hashes, #backends, #check_file, #check_table, #compile_conditions, #delimited_to_arrays, #describe_table, #faked_count, #field_names_for, #mdb_export, #mdb_schema, #mdb_sql, #mdb_tables, #mdb_truth, #mdb_version, #methodize, #sanitize!, #sql_select_where, #table_to_csv, #valid_file?

Constructor Details

#initialize(mdb_table, line) ⇒ Record

Returns a new instance of Record.



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

def initialize(mdb_table, line)
  raise 'no results' unless line
  @struct = mdb_table.record_struct
  @data = @struct.new(*line)
  create_accessors
end

Instance Method Details

#compactObject



19
20
21
# File 'lib/active_mdb/record.rb', line 19

def compact
  self.select {|k,v| v && !v.empty? && v != "0" }
end

#each(&block) ⇒ Object



15
16
17
# File 'lib/active_mdb/record.rb', line 15

def each(&block)
  @data.members.each {|k| yield k, @data[k] }
end