Sha256: c3a775c4061a509a1ca659b531701d584391e282b1d6db7e6b4d99874017699a
Contents?: true
Size: 1.29 KB
Versions: 3
Compression:
Stored size: 1.29 KB
Contents
require 'lotus/utils/class' module Lotus module Commands class DB class Console attr_reader :name, :env_options, :environment def initialize(name, environment) @name = name @environment = environment @env_options = environment.to_options load_config end def start exec connection_string end private def config if name app_constant = Lotus::Utils::Class.load_from_pattern!(Lotus::Utils::String.new(name).classify) Lotus::Utils::Class.load_from_pattern!("#{app_constant}::Application").load! Lotus::Utils::Class.load_from_pattern!("#{app_constant}::Model").configuration else Lotus::Model.configuration end end def adapter_config config.adapter_config end def mapper config.mapper end def adapter_class Lotus::Utils::Class.load_from_pattern!(adapter_config.class_name, Lotus::Model::Adapters) end def connection_string adapter_class.new(mapper, adapter_config.uri).connection_string end def load_config require @env_options[:env_config] end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lotusrb-0.3.2 | lib/lotus/commands/db/console.rb |
lotusrb-0.3.1 | lib/lotus/commands/db/console.rb |
lotusrb-0.3.0 | lib/lotus/commands/db/console.rb |