Class: DbTransformer::Rules::Rename

Inherits:
Object
  • Object
show all
Defined in:
lib/db_transformer/rules/rename.rb

Class Method Summary collapse

Class Method Details

.apply(mode, row, column, options) ⇒ Object



5
6
7
8
9
10
# File 'lib/db_transformer/rules/rename.rb', line 5

def apply(mode, row, column, options)
  case mode
  when 'template'
    template(row, column, options['template'])
  end
end

.template(row, column, template) ⇒ Object

Parameters:

  • row (Hash)
  • column (String)
  • template (String)


15
16
17
18
19
# File 'lib/db_transformer/rules/rename.rb', line 15

def template(row, column, template)
  row.tap do |t|
    t[column.to_sym] = template % row
  end
end