has_all() Return 1. If block is given, return 1 if all results are true, otherwise 0.
rh()->has_all                                  # return 1
rh(1, 2, 3)->has_all                           # return 1
rh(2, 4, 6)->has_all( sub { $_[0] % 2 == 1 } ) # return 0
has_any() Check if any entry exists. When block given, check if any result returned by block are true.
rh( 1 => 2 )->has_any # return 1
rh->has_any           # return 0
rh ( 2 => 4, 6 => 8 )->has_any( sub { $_[0] % 2 == 1 } ) # return 0
assoc() Find the key and return the key-value pair in a Ruby::Collections::Array. Return undef if key is not found.
rh( 'a' => 123, 'b' => 456 )->assoc('b') # return [ 'b', 456 ]
rh( 'a' => 123, 'b' => 456 )->assoc('c') # return undef
chunk() Chunk consecutive elements which is under certain condition into [ condition, [ [ key, value ]... ] ] array.
rh( 1 => 1, 2 => 2, 3 => 3, 5 => 5, 4 => 4 )->chunk( sub { $_[0] % 2 } )
#return  [ [ 1, [ [ 1, 1 ] ] ],
           [ 0, [ [ 2, 2 ] ] ],
           [ 1, [ [ 3, 3 ], [ 5, 5 ] ] ],
           [ 0, [ [ 4, 4 ] ] ] ]
claer() Clear all keys and values.
delete() Delete the kry-value pair by key, return the value after deletion. If block is given, passing the value after deletion and return the result of block.
rh( 'a' => 1 )->delete('a')                     # return 1
rh( 'a' => 1 )->delete('b')                     # return undef
rh( 'a' => 1 )->delete( 'a', sub{ $_[0] * 3 } ) # return 3
count() Count the number of key-value pairs. If block is given, count the number of results returned by the block which are true.
rh( 'a' => 'b', 'c' => 'd' )->count # return 2
rh( 1 => 3, 2 => 4, 5 => 6 )->count( sub {
	  my ( $key, $val ) = @_;
	  $key % 2 == 0 && $val % 2 == 0;
} )
# return 1
cycle() Apply the block with each key-value pair repeatedly. If a limit is given, it only repeats limit of cycles.
rh( 1 => 2, 3 => 4 )->cycle( sub { print "$_[0], $_[1], " } )
# print 1, 2, 3, 4, 1, 2, 3, 4... forever

rh( 1 => 2, 3 => 4 )->cycle( 1, sub { print "$_[0], $_[1], " } )
# print 1, 2, 3, 4, 
delete_if() Pass all key-value pairs into the block and remove them out of self if the results returned by the block are true.
rh( 1 => 3, 2 => 4 )->delete_if( sub {
	  my ( $key, $val ) = @_;
	  $key % 2 == 1;
} )
# return { 2 => 4 }
drop() Remove the first n key-value pair and store rest of elements in a new Ruby::Collections::Array.
rh( 1 => 2, 3 => 4, 5 => 6)->drop(1) # return [ [ 3, 4 ], [ 5, 6 ] ]
drop_while() Remove the first n key-value pair until the result returned by the block is true and store rest of elements in a new Ruby::Collections::Array.
rh( 0 => 2, 1 => 3, 2 => 4, 5 => 7)->drop_while( sub {
	  my ( $key, $val ) = @_;
	  $key % 2 == 1;
} )
# return [ [ 1, 3 ], [ 2, 4 ], [ 5, 7 ] ]
each() Iterate each key-value pair and pass it to the block one by one. Return self. Alias: each_entry(), each_pair()
rh( 1 => 2, 3 => 4)->each( sub {
    my ( $key, $val ) = @_;
    print "$key, $val, "
} )
# print 1, 2, 3, 4, 
each_cons() Iterates each key-value pair([ k, v ]) as array of consecutive <n> elements.
rh( 1 => 2, 3 => 4, 5 => 6 )->each_cons( 2, sub{
	  my ($sub_ary) = @_;
	  p $sub_ary[0]->zip($sub_ary[1]);
} )
# print "[[1, 3], [2, 4]]\n[[3, 5], [4, 6]]\n"
each_slice() Put each key and value into a Ruby::Collections::Array and chunk them into other Ruby::Collections::Array(s) of size n.
rh( 1 => 2, 3 => 4, 5 => 6 )->each_slice(2)
# return [ [ [ 1, 2 ], [ 3, 4] ], [ [ 5, 6 ] ] ]
each_key() Put each key in to a Ruby::Collections::Array.
rh( 1 => 2, 'a' => 'b', [ 3, { 'c' => 'd' } ] => 4 ).each_key( sub {
	  print "$_[0], "
} )
# print "1, a, [3, {c=>d}], "
each_value() Put each value in to a Ruby::Collections::Array.
rh( 1 => 2, 'a' => undef, '3' => rh( [2] => [3] ) )->each_value( sub {
    print "$_[0], "
} )
# print "2, undef, {[2]=>[3]}, "
each_with_index() Iterate each key-value pair and pass it with index to the block one by one. Return self.
rh( 'a' => 'b', 'c' => 'd' )->each_with_index( sub {
    my ( $key, $val, $index ) = @_;
    print "$key, $val, $index, "
} )
# print "a, b, 0, c, d, 1, " 
each_with_object() Iterate each key-value pair and pass it with an object to the block one by one. Return the object.
my $ra = ra;
rh( 1 => 2, 3 => 4 )->each_with_object( $ra, sub {
    my ( $key, $val, $obj ) = @_;
    $obj->push( $key, $val );
} );
p $ra;
# print "[1, 2, 3, 4]\n" 
is_empty() Check if Ruby::Collections::Hash is empty or not.
rh()->is_empty         # return 1
rh( 1 => 2 )->is_empty # return 0
entries() Put each key-value pair to a Ruby::Collections::Array.
rh( 1 => 2, 3 => 4)->entries # return [ [ 1, 2 ], [ 3, 4 ] ]
eql Check if contents of both hashes are the same. Key order is not matter.
rh( 1 => 2, 3 => 4 )->eql( { 3 => 4, 1 => 2 } )       # return 1
rh( [1] => 2, 3 => 4 )->eql( { 3 => 4, [1] => 2 } )   # return 0
rh( [1] => 2, 3 => 4 )->eql( rh( 3 => 4, [1] => 2 ) ) # return 1
fetch() Retrieve the value by certain key. Throw an exception if key is not found. If default value is given, return the default value when key is not found. If block is given, pass the key into the block and return the result when key is not found.
rh( 1 => 2, 3 => 4 )->fetch(1)                          # return 2
rh( 1 => 2, 3 => 4 )->fetch( 5, 10 )                    # return 10
rh( 1 => 2, 3 => 4 )->fetch( 5, sub { $_[0] * $_[0] } ) # return 25
find() Find the first key-value pair which result returned by the block is true. If default is given, return the default when such pair can't be found. Alias: detect()
rh( 'a' => 1, 'b' => 2 )->find( sub {
    my ( $key, $val ) = @_;
    $val % 2 == 0;
} )
# return [ 'b', 2 ]

rh( 'a' => 1, 'b' => 2 )->detect( sub { 'Not Found!' }, sub {
    my ( $key, $val ) = @_;
    $val % 2 == 3;
} )
# return 'Not Found!'
find_all() Pass each key-value pair to the block and store all elements which are true returned by the block to a Ruby::Collections::Array.
rh( 'a' => 'b', 1 => 2, 'c' => 'd', 3 => '4')->select(
    sub {
        my ( $key, $val ) = @_;
        looks_like_number($key) && looks_like_number($val);
    }
)
# return [ [ 1, 2 ], [ 3, 4 ] ]
find_index() Find the position of pair under certain condition. Condition can be an array which contains the target key & value or can be a block.
rh( 1 => 2, 3 => 4 )->find_index( [ 5, 6 ] )           # return undef
rh( 1 => 2, 3 => 4 )->find_index( [ 3, 4 ] )           # return 1
rh( 1 => 2, 3 => 4 )->find_index( sub { $_[0] == 1 } ) # return 0
first() Return the first element. If n is specified, return the first n elements.
rh( 1 => 2, 3 => 4)->first    # return [ [ 1, 2 ] ]
rh( 1 => 2, 3 => 4)->first(5) # return [ [ 1, 2 ], [ 3, 4 ] ]
flat_map() Call map(), then call flatten(1). Alias: collect_concat()
rh( 1 => 2, 3 => 4 )->flat_map(
    sub {
        my ( $key, $val ) = @_;
        [ $key * $val ];
    }
)
# return [ 2, 12 ]
flatten() Push each key & value into a Ruby::Collections::Array. If n is specified, call flatten( n - 1 ) on the Ruby::Collections::Array.
rh( 1 => [ 2, 3 ], 4 => 5 )->flatten    # return [ 1, [ 2, 3 ], 4, 5 ]
rh( 1 => [ 2, 3 ], 4 => 5 )->flatten(2) # return [ 1, 2, 3, 4, 5 ]
grep() Using regex to match elements and store them in a Ruby::Collecitons::Array. If block is given, transform each element by the block. Note: This implementation is different from Ruby due to the missing of === operator in Perl.
rh( 'a' => 1, '2' => 'b', 'c' => 3 )->grep(qr/^\[[a-z]/) # return [[a, 1], [c, 3]]
rh( 'a' => 1, '2' => 'b', 'c' => 3 )->grep( qr/^\[[a-z]/, sub {
	  $_[0] << 'z';
})
# return [[a, 1, z], [c, 3, z]]
group_by() Group each element by the result of block, store them in a Ruby::Collections::Hash.
rh( 1 => 3, 0 => 4, 2 => 5 )->group_by(sub {
	  $_[0] + $_[1]
})
#return
include() Check if key exists. Alias: has_key(), has_member()
rh( 1 => 2, [ 3, { 4 => 5 } ] => 5, undef => 6 )->include(1)                 # return 1
rh( 1 => 2, [ 3, { 4 => 5 } ] => 6, undef => 7 )->has_key([ 3, { 4 => 5 } ]) # return 1
rh( 1 => 2, [ 3, { 4 => 5 } ] => 5, undef => 6 )->has_member(undef)          # return 1
rh( 1 => 2, [ 3, { 4 => 5 } ] => 5, undef => 6 )->include(7)                 # return 0
inject() Passing the result of block by each iteration to next iteration, return the final result in the end. Alias: reduce()
rh( 1 => 2, 3 => 4, 5 => 6 )->inject( sub {
	  my ( $o, $i ) = @_;
	  @$o[0] += @$i[0];
	  @$o[1] += @$i[1];
	  $o;
})
# return [ 9, 12 ]
rh( 1 => 2, 3 => 4, 5 => 6 )->inject( [ 7, 7 ], sub {
    my ( $o, $i ) = @_;
    @$o[0] += @$i[0];
    @$o[1] += @$i[1];
    $o;
})
# return [ 16, 19 ]
inspect() Return the data structure in string form of self. Alias: to_s()
rh( [ 1, 2 ] => 3, 'a' => 'b' )->inspect # return { [ 1, 2 ] => 3, a => b }
Invert the whole hash. Let values be the keys and keys be the values.
rh( 1 => 'a', 2 => 'b', 3 => 'a' )->invert # return { a => 3, b => 2 }
keep_if() Pass all key-value pairs to the block and only keep the elements which get the results returned by the block are true.
rh( 1 => 1, 2 => 2, 3 => 3 )->keep_if( sub { $_[0] % 2 == 1 } ) # return { 1 => 1, 3 => 3 }
key() Find the key by value.
rh( 1 => 2, 3 => 2 )->key(2) # return 1
rh( 1 => 2, 3 => 2 )->key(4) # return undef
keys() Put all keys in a Ruby::Collections::Array.
rh( 1 => 2, 3 => 4, 5 => 6 )->keys # return [ 1, 3, 5 ]
length() Return the number of key-value pairs. Alias: size()
rh->length                # return 0
rh( 1 => 2, 3 => 4)->size # return 2
map() Transform each key-value pair and store them into a new Ruby::Collections::Array. Alias: collect()
rh( 1 => 2, 3 => 4 )->map(
    sub {
        my ( $key, $val ) = @_;
        $key * $val;
    }
)
# return [ 2, 12 ]
max() Find the max element of a Ruby::Collections::Hash. transform each element to scalar then compare it.
rh( 6 => 5, 11 => 3, 2 => 1 )->max                                        # return [ 6, 5 ]
rh( 6 => 5, 11 => 3, 2 => 1 )->max( sub { @{$_[0]}[0] <=> @{$_[1]}[0] } ) # return [ 11, 3 ]
max_by() Transform all elements by the given block and then find the max. Return the element which is the origin of the max.
rh( 6 => 5, 11 => 3, 2 => 20 )->max_by( sub { @{$_[0]}[0] + @{$_[0]}[1] } ) # return [ 2, 20 ]
merge() Merge all key-value pairs of other hash with self elements into a new Ruby::Collections::Hash.
rh( 1 => 2, 3 => 4 )->merge( { 3 => 3, 4 => 5 } ) # return { 1 => 2, 3 => 3, 4 => 5 }
mergeEx() Merge all key-value pairs of other hash with self elements and save result into self.
rh( 1 => 2, 3 => 4 )->mergeEx( { 3 => 3, 4 => 5 } ) # return { 1 => 2, 3 => 3, 4 => 5 }
min() Find the min element of a Ruby::Collections::Hash. If block is not given, transform each element to scalar then compare it.
rh( 6 => 5, 11 => 3, 2 => 1 )->min # return [ 11, 3 ]
rh( 6 => 5, 11 => 3, 2 => 1 )->min( sub {
	  @{$_[0]}[1] - @{$_[0]}[0] <=> @{$_[1]}[1] - @{$_[1]}[0]
})
# return [ 11, 3 ]
min_by() Transform all elements by the given block and then find the max. Return the element which is the origin of the max.
rh( 6 => 5, 11 => 3, 2 => 20 )->min_by( sub { @{$_[0]}[0] + @{$_[0]}[1] } ) # return [ 6, 5 ]
minmax() Find the min & max elements of a Ruby::Collections::Hash. If block is not given, transform each element to scalar then compare it.
rh( 1 => 10, 2 => 9, 3 => 8 )->minmax # return [ [ 1, 10 ], [ 3, 8] ]
rh( 1 => 10, 2 => 9, 3 => 8 )->minmax( sub {
    @{$_[0]}[1] - @{$_[0]}[0] <=> @{$_[1]}[1] - @{$_[1]}[0]
})
# return [ [ 3, 8 ], [ 1, 10 ] ]
minmax_by() Transform all elements by the given block and then find the min & max. Return the element which is the origin of the min & max.
rh( 6 => 5, 11 => 3, 2 => 20 )->minmax_by( sub { @{$_[0]}[0] * @{$_[0]}[1] } )
# return [ [ 6, 5 ], [ 2, 20 ] ]
has_none() If hash is empty, return 1, otherwise 0. If block is given and all results of block are false, return 1, otherwise 0.
rh->has_none                                                   # return 1
rh( 1 => 2 )->has_none                                         # return 0
rh( 'a' => 'b' )->has_none( sub {
	  my ( $key, $val ) = @_;
	  looks_like_number($key);
})
# return 1
has_one() If hash has one element, return 1, otherwise 0. If block is given and one result of block are true, return 1, otherwise 0.
rh->has_one                                                           # return 0
rh( 1 => 2 )->has_one                                                 # return 1
rh( 'a' => 'b', 1 => 2 )->has_one( sub {
	  my ( $key, $val ) = @_;
    looks_like_number($key);
})
# return 1
partition() Separate elements into 2 groups by given block.
rh( 'a' => 1, 2 => 'b', 'c' => 3, 4 => 'd' )->partition( sub{
	  my ( $key, $val ) = @_;
	  looks_like_number($key);
})
rassoc() Find the value and return the key-value pair in a Ruby::Collections::Array. Return undef if value is not found.
rh( 'a' => 123, 'b' => 123 )->rassoc(123) # return [ 'a', 123 ]
rh( 'a' => 123, 'b' => 123 )->rassoc(456) # return undef
reject() Pass all key-value pairs into the block and store them into a Ruby::Collecitons::Array if the results returned by the block are false.
rh( 1 => 3, 2 => 4, 5 => 6 )->reject( sub {
    my ( $key, $val ) = @_;
    $key % 2 == 1;
} )
# return { 2 => 4, 5 => 6 }
rejectEx() Pass all key-value pairs into the block and remove them out of self if the results returned by the block are true. Return undef if nothing is deleted.
rh( 1 => 3, 2 => 4 )->rejectEx( sub {
    my ( $key, $val ) = @_;
    $key % 2 == 1;
} )
# return { 2 => 4 }
rh( 1 => 3, 2 => 4 )->rejectEx( sub {
    my ( $key, $val ) = @_;
    $key == 5;
} )
# return undef
reverse_each() Iterate key-value pair backward to a block.
rh( 1 => 2, 3 => 4, 5 => 6 )->reverse_each( sub {
	  my ( $key, $val ) = @_;
	  print "$key, $val, ";
} )
# print "5, 6, 3, 4, 1, 2, "
replace() Replace all elements with other hash.
rh( 1 => 2 )->replace( { 3 => 4, 5 => 6 } ) # return { 3 => 4, 5 => 6 } 
select() Pass each key-value pair to the block and remain all elements which are true returned by the block in self. Return undef if nothing changed.
rh( 'a' => 'b', 1 => 2, 'c' => 'd', 3 => '4')->select(
    sub {
        my ( $key, $val ) = @_;
        looks_like_number($key) && looks_like_number($val);
    }
)
# return { 1 => 2, 3 => 4 }
selectEx() Pass each key-value pair to the block and remain all elements which are true returned by the block in self. Return undef if nothing changed.
rh( 'a' => 'b', 1 => 2, 'c' => 'd', 3 => '4')->selectEx(
    sub {
        my ( $key, $val ) = @_;
        looks_like_number($key) && looks_like_number($val);
    }
)
# return { 1 => 2, 3 => 4 }
rh( 'a' => 'b', 1 => 2, 'c' => 'd', 3 => '4')->selectEx(
    sub {
        my ( $key, $val ) = @_;
        $key == 5;
    }
)
# return undef
shift() Shift the first key-value pair out of self.
rh( 1 => 2 )->shift # return [ 1, 2 ]
rh->shift           # undef
slice_before() Separate elements into groups, the first element of each group is defined by block or regex.
rh( 'a' => 1, 'b' => 0, 'c' => 0, 'd' => 1 )->slice_before( sub {
	  my ( $key, $val ) = @_;
	  $val == 0;
} )
# return [ [ [ a, 1 ] ], [ [ b, 0 ] ], [ [ c, 0 ], [ d, 1 ] ] ]
rh( 'a' => 1, 'b' => 0, 'c' => 0, 'd' => 1 )->slice_before(qr/^\[[a-z]/)
# return [ [ [ a, 1 ] ], [ [ b, 0 ] ], [ [ c, 0 ] ], [ [ d, 1 ] ] ]
store() Store a key-value pair.
rh( 1 => 2 )->store( 3, 4 ) # return 4
take() Take first n elements and put them into a Ruby::Collections::Array.
rh( 1 => 2, 3 => 4, 5 => 6 )->take(2) # return [ [ 1, 2 ], [ 3, 4 ] ]
take_while() Start to take elements while result returned by block is true and put them into a Ruby::Collections::Array.
rh( 1 => 2, 3 => 4, 5 => 6 )->take_while( sub {
	  my ( $key, $val ) = @_;
	  $key <= 3;
} )
# return [ [ 1, 2 ], [ 3, 4 ] ]
to_a() Converts self to a nested array of [ key, value ] Ruby::Collections::Array.
rh( 1 => 2, 'a' => 'b' )->to_a # return [ [ 1, 2 ], [ a, b ] ]
to_h() Return self; Alias: to_hash()
has_value() Retuen 1 if a value exists, otherwise 0.
rh( 1 => 2, 3 => 4 )->has_value(4) # return 1
rh( 1 => 2, 3 => 4 )->has_value(5) # return 0
values_at() Put all values corresponding to the input keys into a Ruby::Collections::Array.
rh( 1 => 2, 3 => 4, 5 => 6 )->values_at( 3, 4, 6 ) # return [ 4, undef, undef ]
zip() Call to_a first, then zip an array of elements into self.
rh( 1 => [ 2, 3 ], 4 => [ 5, 6 ], 7 => 8 )->zip( [ 9, 10 ] )
# return [ [ [ 1, [ 2, 3 ] ], 9 ], [ [ 4, [ 5, 6 ] ], 10 ], [ [ 7, 8 ], undef ] ]

1 POD Error

The following errors were encountered while parsing the POD:

Around line 27:

'=item' outside of any '=over'

=over without closing =back