(FEAT) Add quality of life utilities #11
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit adds four new utilities to the gem:
snake_case: returns a string which issnake_cased.snake_case_hash_keys: returns a hash in which all of the keys aresnake_cased.pascal_case: returns a string which isPascalCased.pascal_case_hash_keys: returns a hash in which all of the keys arePascalCased.escape_quotes: ensures that any string passed will be returned wrapped in double quotes for passing into PowerShell; this is because of the interpolation required when sending code to the PowerShell manager.format_powershell_value: converts ruby data types into strings of their PowerShell representation for interpolation and passing to the PowerShell manager.custom_powershell_property: takes a name and an expression and returns a string which represents a PowerShell custom object property hash. The expression being passed must already be an interpolated string as this method does not do any additional work for interpolation; whatever is passed is what will end up as PowerShell code in the expression script block.These methods make interaction between Ruby and PowerShell a little easier by handling common translation problems when moving between Ruby and PowerShell objects.