Sha256: e5cce272e95987bf699466cb2a14b11e1b777eafd597bace53bed488b53227a4

Contents?: true

Size: 554 Bytes

Versions: 12

Compression:

Stored size: 554 Bytes

Contents

module Storey
  class Utils

    def self.db_command_line_switches_from(db_config={}, extra_config={})
      switches = {}
      if db_config.has_key?(:host)
        switches[:host] = db_config[:host]
      end
      switches[:dbname] = db_config[:database]
      switches[:username] = db_config[:username]
      command_line_switches_from switches.merge(extra_config)
    end

    def self.command_line_switches_from(hash={})
      hash.map do |k, v|
        arg = "--#{k}"
        arg << "=#{v}" if v
        arg
      end.join(' ')
    end

  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
storey-2.2.0 lib/storey/utils.rb
storey-2.1.2 lib/storey/utils.rb
storey-2.1.1 lib/storey/utils.rb
storey-2.1.0 lib/storey/utils.rb
storey-2.0.2 lib/storey/utils.rb
storey-2.0.1 lib/storey/utils.rb
storey-2.0.0 lib/storey/utils.rb
storey-1.0.0 lib/storey/utils.rb
storey-0.6.0 lib/storey/utils.rb
storey-0.5.2 lib/storey/utils.rb
storey-0.5.1 lib/storey/utils.rb
storey-0.5.0 lib/storey/utils.rb