Sha256: 7ff4f4c3480270e49a976f6adc120ac868cc012df305dd5a8f934f04dc55601c

Contents?: true

Size: 549 Bytes

Versions: 4

Compression:

Stored size: 549 Bytes

Contents

module Hyperkit

  # Utility methods for Hyperkit
  module Utility

    private

    # Stringify the keys and values of a hash
    #
    # LXD often chokes on non-String JSON values.  This method simply
    # takes a Hash and stringifies its keys and values.  The result
    # can then be converted to JSON and passed to LXD.
    #
    # @param input [Hash] Original Hash
    # @return A copy of the Hash, with its keys and values stringified
    def stringify_hash(input)
      input.inject({}){|h,(k,v)| h[k.to_s] = v.to_s; h}
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hyperkit-1.3.0 lib/hyperkit/utility.rb
hyperkit-1.2.0 lib/hyperkit/utility.rb
hyperkit-1.1.0 lib/hyperkit/utility.rb
hyperkit-1.0.2 lib/hyperkit/utility.rb