Class: Columns::ModelCleaner

Inherits:
Object
  • Object
show all
Defined in:
lib/columns/model_cleaner.rb

Overview

This class is responsible of removing a possible schema info from a ruby model file. Note that it isn’t any attempt to actually check if we really deals with a model.

Class Method Summary collapse

Class Method Details

.clean(file_path) ⇒ Object

Public: Removes schema info.

file_path - An absolute String file name.

Returns nothing.



13
14
15
16
# File 'lib/columns/model_cleaner.rb', line 13

def self.clean(file_path)
  %x( sed -i -e '/# == Schema Info/,$d' #{file_path}  > /dev/null 2>&1 )
  %x( sed -i -e '${/^$/d;}' #{file_path} > /dev/null 2>&1 )
end