class DumpTruck::DatabaseConfiguration

Attributes

type[R]

Public Class Methods

new(type) click to toggle source
# File lib/dump_truck/database_configuration.rb, line 5
def initialize(type)
  @type = type
  @schemas = {}

  instance_eval(&Proc.new) if block_given?
end

Public Instance Methods

==(other) click to toggle source
# File lib/dump_truck/database_configuration.rb, line 49
def ==(other)
  type = other.type &&
    user == other.user &&
    password == other.password &&
    hostname == other.hostname &&
    schemas == other.schemas
end
each_schema() click to toggle source
# File lib/dump_truck/database_configuration.rb, line 41
def each_schema
  if block_given?
    schemas.each(&Proc.new)
  else
    schemas.each
  end
end
hostname(hostname = nil) click to toggle source
# File lib/dump_truck/database_configuration.rb, line 28
def hostname(hostname = nil)
  @hostname = hostname || @hostname
end
password(password = nil) click to toggle source
# File lib/dump_truck/database_configuration.rb, line 24
def password(password = nil)
  @password = password || @password
end
schema(name, &block) click to toggle source
# File lib/dump_truck/database_configuration.rb, line 32
def schema(name, &block)
  name = name.to_s
  @schemas[name] = SchemaConfiguration.new(name, &block)
end
schemas() click to toggle source
# File lib/dump_truck/database_configuration.rb, line 37
def schemas
  @schemas.values
end
ssh_hostname(ssh_hostname = nil) click to toggle source
# File lib/dump_truck/database_configuration.rb, line 16
def ssh_hostname(ssh_hostname = nil)
  @ssh_hostname = ssh_hostname || @ssh_hostname
end
ssh_user(ssh_user = nil) click to toggle source
# File lib/dump_truck/database_configuration.rb, line 12
def ssh_user(ssh_user = nil)
  @ssh_user = ssh_user || @ssh_user
end
to_s() click to toggle source
# File lib/dump_truck/database_configuration.rb, line 57
def to_s
  "<DumpTruck::DatabaseConfiguration(#{type}) (#{schemas.map(&:to_s).join(', ')})>"
end
user(user = nil) click to toggle source
# File lib/dump_truck/database_configuration.rb, line 20
def user(user = nil)
  @user = user || @user
end