Class: Plog::Scanner
- Inherits:
-
Object
- Object
- Plog::Scanner
- Defined in:
- lib/plog/scanner.rb
Class Method Summary collapse
-
.constant(table_name) ⇒ Object
TODO: optimize.
- .load(io, config, &block) ⇒ Object
- .record(table_name) ⇒ Object
Class Method Details
.constant(table_name) ⇒ Object
TODO: optimize
23 24 25 26 27 |
# File 'lib/plog/scanner.rb', line 23 def constant table_name config = @config.find { |hash| hash[:table_name] == table_name } RecordAbstraction.setup(config) RecordAbstraction.record_constant end |
.load(io, config, &block) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/plog/scanner.rb', line 7 def load(io, config, &block) @config = config @config.each do |table| RecordAbstraction.setup(table) unless RecordAbstraction.record_exists? RecordAbstraction.migration_constant.up end end io.each_line { |line| yield(line, self) } end |
.record(table_name) ⇒ Object
18 19 20 |
# File 'lib/plog/scanner.rb', line 18 def record table_name constant(table_name).new end |