Class: Convoy::Utils

Inherits:
Object
  • Object
show all
Defined in:
lib/convoy/utils.rb

Class Method Summary collapse

Class Method Details

.symbolize_keys(hash) ⇒ Object


6
7
8
9
10
11
12
13
# File 'lib/convoy/utils.rb', line 6

def symbolize_keys(hash)
    hash.inject({}) do |result, (key, value)|
        new_key         = (key.kind_of?(String) ? key.to_sym : key)
        new_value       = (value.kind_of?(Hash) ? symbolize_keys(value) : value)
        result[new_key] = new_value
        result
    end
end

.tokenize_option_string(option_string) ⇒ Object


15
16
17
18
# File 'lib/convoy/utils.rb', line 15

def tokenize_option_string(option_string)
    option_string ||= ''
    Shellwords.shellwords(option_string)
end