Class: ShopifyCLI::Migrator::Migration

Inherits:
Object
  • Object
show all
Defined in:
lib/shopify_cli/migrator/migration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, path:, date:) ⇒ Migration

Returns a new instance of Migration.



9
10
11
12
13
# File 'lib/shopify_cli/migrator/migration.rb', line 9

def initialize(name:, path:, date:)
  @name = name
  @path = path
  @date = date
end

Instance Attribute Details

#dateObject (readonly)

Returns the value of attribute date.



7
8
9
# File 'lib/shopify_cli/migrator/migration.rb', line 7

def date
  @date
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/shopify_cli/migrator/migration.rb', line 7

def name
  @name
end

#pathObject (readonly)

Returns the value of attribute path.



7
8
9
# File 'lib/shopify_cli/migrator/migration.rb', line 7

def path
  @path
end

Instance Method Details

#class_nameObject



22
23
24
# File 'lib/shopify_cli/migrator/migration.rb', line 22

def class_name
  name.split("_").collect(&:capitalize).join
end

#runObject



15
16
17
18
19
20
# File 'lib/shopify_cli/migrator/migration.rb', line 15

def run
  require(path)
  ShopifyCLI::Migrator::Migrations.const_get(class_name).run
rescue StandardError
  # Continue
end