Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/core_ext/hash.rb
Instance Method Summary collapse
-
#to_params ⇒ Object
Generate params string based on hash content ‘value’, ‘-a’: nil, ‘–config’: ‘path/to/config’.to_params # “–param value -a –config path/to/config”.
Instance Method Details
#to_params ⇒ Object
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 |