Class: DatabaseStalker::Parser
- Inherits:
-
Object
- Object
- DatabaseStalker::Parser
- Defined in:
- lib/database_stalker/parser.rb
Instance Method Summary collapse
-
#initialize(log_file) ⇒ Parser
constructor
A new instance of Parser.
- #table_names ⇒ Object
Constructor Details
#initialize(log_file) ⇒ Parser
Returns a new instance of Parser.
2 3 4 |
# File 'lib/database_stalker/parser.rb', line 2 def initialize(log_file) @log_file = log_file end |
Instance Method Details
#table_names ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/database_stalker/parser.rb', line 6 def table_names tables = [] File.open(@log_file, 'r') do |f| f.each_line do |line| matched = line.match(/INSERT\ INTO\ `(.+)` \(/) tables << matched[1] unless matched.nil? end end tables.uniq end |