Class: ActiveRecord::Migrator

Inherits:
Object
  • Object
show all
Defined in:
lib/jun/active_record/migrator.rb

Constant Summary collapse

ALLOWED_DIRECTIONS =
%w[up down].freeze

Instance Method Summary collapse

Constructor Details

#initialize(direction:) ⇒ Migrator

Returns a new instance of Migrator.



7
8
9
10
11
12
13
# File 'lib/jun/active_record/migrator.rb', line 7

def initialize(direction:)
  unless ALLOWED_DIRECTIONS.include?(direction.to_s)
    raise ArgumentError, "direction must be one of: #{ALLOWED_DIRECTIONS.inspect}"
  end

  @direction = direction.to_s
end

Instance Method Details

#callObject



15
16
17
# File 'lib/jun/active_record/migrator.rb', line 15

def call
  process_migrations!
end