method

dump_hash

ruby latest stable - Class: Bundler::YAMLSerializer

Method not available on this version

This method is only available on newer versions. The first available version (v2_6_3) is shown here.

dump_hash(hash)
public

No documentation available.

# File lib/bundler/yaml_serializer.rb, line 13
    def dump_hash(hash)
      yaml = String.new("\n")
      hash.each do |k, v|
        yaml << k << ":"
        if v.is_a?(Hash)
          yaml << dump_hash(v).gsub(/^(?!$)/, "  ") # indent all non-empty lines
        elsif v.is_a?(Array) # Expected to be array of strings
          yaml << "\n- " << v.map {|s| s.to_s.gsub(/\s+/, " ").inspect }.join("\n- ") << "\n"
        else
          yaml << " " << v.to_s.gsub(/\s+/, " ").inspect << "\n"
        end
      end
      yaml
    end