Class: Migrate::Lang::Python
Instance Attribute Summary
Attributes inherited from Lang
Instance Method Summary collapse
- #create_migration(dir) ⇒ Object
- #exec_migration(dir, is_up) ⇒ Object
-
#initialize ⇒ Python
constructor
A new instance of Python.
Constructor Details
#initialize ⇒ Python
Returns a new instance of Python.
4 5 6 |
# File 'lib/migrate/lang/python.rb', line 4 def initialize @ext = "py" end |
Instance Method Details
#create_migration(dir) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/migrate/lang/python.rb', line 8 def create_migration(dir) File.open("#{dir}/up.#{@ext}", "w") do |f| f.puts "# Here goes Python code for migration forward\n" end File.open("#{dir}/down.#{@ext}", "w") do |f| f.puts "# Here goes Python code for migration backward\n" end end |