Class: Storey::Utils
- Inherits:
-
Object
- Object
- Storey::Utils
- Defined in:
- lib/storey/utils.rb
Class Method Summary collapse
- .command_line_switches_from(hash = {}) ⇒ Object
- .db_command_line_switches_from(db_config = {}, extra_config = {}) ⇒ Object
Class Method Details
.command_line_switches_from(hash = {}) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/storey/utils.rb', line 14 def self.command_line_switches_from(hash={}) hash.map do |k, v| arg = "--#{k}" arg << "=#{v}" if v arg end.join(' ') end |
.db_command_line_switches_from(db_config = {}, extra_config = {}) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/storey/utils.rb', line 4 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 |