Skip to content

Latest commit

 

History

History
100 lines (67 loc) · 1.63 KB

hashes.md

File metadata and controls

100 lines (67 loc) · 1.63 KB

Hash

{id: hash}

Hash intro

{id: hash-intro} {i: has_key} {i: has_value} {i: each_key} {i: size} {i: keys}

Count words

{id: count-words} {i: each}

Create empty hash

{id: create-empty-hash} {i: empty?}

Hash and types

{id: hash-and-types}

Hash get value, get default value

{id: hash-get-value}

  • Get value of a key
  • Get value or nil if the key does not exist
  • Get value of a default value if the key does not exist

Merge hashes

{id: hash-merge} {i: merge} {i: merge!}

Delete - remove an element from a hash

{id: hash-delete} {i: delete}

  • delete! does not exist.

Reject - remove an element from a hash

{id: hash-reject} {i: reject} {i: reject!}

Clear - empty a hash

{id: hash-clear} {i: clear}

Select - keep certain key-value pairs

{id: hash-select} {i: select} {i: select!}

Multi-dimensional hash

{id: hash-multi-dimensional}

Dig a hash

{id: hash-dig} {i: dig} {i: dig?}