Method: SQLDependencyGrapher.collect
- Defined in:
- lib/sql_dep_grapher.rb
.collect(stream) ⇒ Object
Returns an Array of SQL joins from stream.
51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/sql_dep_grapher.rb', line 51 def self.collect(stream) data = [] stream.each_line do |line| line.grep(/FROM\s+(.*?)\s+WHERE/) do tables = $1.split(',').reject { |t| t =~ /\(/ } tables = tables.map { |t| t.split(' ').first } data << tables if tables.size > 1 end end return data end |