Class: DeclareSchema::SchemaChange::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/declare_schema/schema_change/base.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.format_options(options) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/declare_schema/schema_change/base.rb', line 9

def format_options(options)
  options.map do |k, v|
    value =
      if v.is_a?(Hash)
        "{ #{format_options(v).join(', ')} }"
      else
        v.inspect
      end
    if k.is_a?(Symbol)
      "#{k}: #{value}"
    else
      "#{k.inspect} => #{value}"
    end
  end
end

Instance Method Details

#downObject



30
31
32
# File 'lib/declare_schema/schema_change/base.rb', line 30

def down
  down_command + spacing(down_command)
end

#upObject



26
27
28
# File 'lib/declare_schema/schema_change/base.rb', line 26

def up
  up_command + spacing(up_command)
end