module ActiveHashExt::ClassMethods

Public Instance Methods

destroy_all() click to toggle source
# File lib/active_hash_ext.rb, line 27
def destroy_all
  delete_all
end
read_schema(table, path) click to toggle source
# File lib/active_hash_ext.rb, line 10
def read_schema(table, path)
  tables = File.read(path).split(/^\s*create_/)[1..-1].map {|table_data| Table.parse table_data }
  table = tables.select do |_table|
    _table.name == table
  end
  unless table.first.nil?
    table.first.attributes.map do |attribute|
      attribute.name.to_sym
    end
  end

  if table.first.nil?
    raise "Table Name not Found!"
  end

end