This is a Ruby tree! It shows every object from the Ruby Programming Language in a tree format.

transform_keys

        # Hash.transform_keys

(from ruby core)
---
    hash.transform_keys {|key| ... } -> new_hash
    hash.transform_keys(hash2) -> new_hash
    hash.transform_keys(hash2) {|other_key| ...} -> new_hash
    hash.transform_keys -> new_enumerator

---

Returns a new Hash object; each entry has:
*   A key provided by the block.
*   The value from `self`.


An optional hash argument can be provided to map keys to new keys. Any
key not given will be mapped using the provided block, or remain the
same if no block is given.

Transform keys:
    h = {foo: 0, bar: 1, baz: 2}
    h1 = h.transform_keys {|key| key.to_s }
    h1 # => {"foo"=>0, "bar"=>1, "baz"=>2}

    h.transform_keys(foo: :bar, bar: :foo)
    #=> {bar: 0, foo: 1, baz: 2}

    h.transform_keys(foo: :hello, &:to_s)
    #=> {:hello=>0, "bar"=>1, "baz"=>2}

Overwrites values for duplicate keys:
    h = {foo: 0, bar: 1, baz: 2}
    h1 = h.transform_keys {|key| :bat }
    h1 # => {:bat=>2}

Returns a new Enumerator if no block given:
    h = {foo: 0, bar: 1, baz: 2}
    e = h.transform_keys # => #<Enumerator: {:foo=>0, :bar=>1, :baz=>2}:transform_keys>
    h1 = e.each { |key| key.to_s }
    h1 # => {"foo"=>0, "bar"=>1, "baz"=>2}



      

This is MURDOC! A Ruby documentation browser inspired by Smalltalk-80. It allows you to learn about Ruby by browsing through its class hierarchies, and see any of its methods.