Ruby - Hash Hash Keys

Introduction

Ruby returns the keys in any hash via the keys method:

Demo

x = { "a" => 1, "b" => 2, "c" => 3 } 
p x.keys

Result

keys returns an array of all the keys in the hash.

values will return an array of all the values in the hash.

Demo

x = { "a" => 1, "b" => 2, "c" => 3 } 
p x.values

Result