Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/core_ext/hash.rb

Instance Method Summary collapse

Instance Method Details

#to_paramsObject

Generate params string based on hash content

{'--param': 'value', '-a': nil, '--config': 'path/to/config'}.to_params
# "--param value -a --config path/to/config"


6
7
8
9
# File 'lib/core_ext/hash.rb', line 6

def to_params
  return '' if self.empty?
  self.flatten.compact.join(' ')
end