Class: RailsFinder::SchemaParser

Inherits:
Object
  • Object
show all
Defined in:
lib/railsfinder/schema_parser.rb

Class Method Summary collapse

Class Method Details

.parse_schema(schema_content) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/railsfinder/schema_parser.rb', line 3

def self.parse_schema(schema_content)
  tables = {}
  schema_content.scan(/create_table ['"](.+?)['"](.+?)end/m).each do |table_name, table_content|
    tables[table_name] = format_table(table_name, table_content.strip)
  end
  tables
end