Class: DataloadMigration

Inherits:
ActiveRecord::Migration
  • Object
show all
Extended by:
FromHash
Defined in:
lib/dataload/migration.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.bObject

Returns the value of attribute b.



3
4
5
# File 'lib/dataload/migration.rb', line 3

def b
  @b
end

.colsObject

Returns the value of attribute cols.



3
4
5
# File 'lib/dataload/migration.rb', line 3

def cols
  @cols
end

.table_nameObject

Returns the value of attribute table_name.



3
4
5
# File 'lib/dataload/migration.rb', line 3

def table_name
  @table_name
end

Class Method Details

.new_migration(ops, &b) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/dataload/migration.rb', line 6

def self.new_migration(ops,&b)
  cls = Class.new(DataloadMigration)
  cls.from_hash(ops)
  cls.b = b
  cls.class_eval do
    def self.up
      instance_eval(&b)
      Dataload.log "Created table #{table_name}"
    end
  end
  cls
end