class Spectifly::Sequel::Configuration

Constants

VALID_CONFIG_KEYS

Attributes

migration_path[RW]
migration_version_type[RW]

Public Class Methods

new(config) click to toggle source
Calls superclass method
# File lib/spectifly/sequel/configuration.rb, line 8
def initialize(config)
  if config.is_a? String
    config = YAML.load_file(config)
  end

  new_config = {}
  config.each { |k, v| new_config[k.to_s] = v }

  begin
    super new_config
    @migration_path = new_config.fetch('sequel_migration_path')
    @migration_version_type = get_version_type new_config['sequel_migration_version_type']
  rescue KeyError => e
    raise "Spectify::Sequel is not configured properly. \"#{e.message.sub(/"$/, '').sub(/^.*"/, '')}\" must be set via YAML or a hash."
  end
end

Public Instance Methods

get_version_type(type) click to toggle source
# File lib/spectifly/sequel/configuration.rb, line 25
def get_version_type type
  if %w(Timestamp Integer).include? type.to_s
    type
  else
    'Timestamp'
  end
end