class SwitchDb::Reference

Attributes

database_names[R]
name[R]

Public Class Methods

new(name:, database_names: []) click to toggle source
# File lib/switch_db/reference.rb, line 5
def initialize(name:, database_names: [])
  @name = name
  @database_names = database_names
end

Public Instance Methods

database_paths() click to toggle source
# File lib/switch_db/reference.rb, line 18
def database_paths
  @database_names.map { |database_name|
    [database_name, full_path.join("#{Utils.escape_filename(database_name)}.sql")]
  }.to_h
end
full_path() click to toggle source
# File lib/switch_db/reference.rb, line 14
def full_path
  SwitchDb.configuration.cache_dir.join(path)
end
path() click to toggle source
# File lib/switch_db/reference.rb, line 10
def path
  Utils.escape_filename(@name)
end
to_h() click to toggle source
# File lib/switch_db/reference.rb, line 24
def to_h
  {
    name: name,
    database_names: database_names
  }
end