Skip to content

Latest commit

 

History

History
32 lines (20 loc) · 954 Bytes

README.rdoc

File metadata and controls

32 lines (20 loc) · 954 Bytes

Install

sudo gem install ruby_extend

Quality Metrics

<img src=“https://codeclimate.com/badge.png” />

Release 1

Extend Hash with to_sorted_array : Recursively sorted array from hash

hash = {'user' => {'adress' => {'town' => 'Paris', 'street' => "rue de Quimper"}, 'name' => 'toto', 'age' => 12}}
hash.to_sorted_array
 # => [["user", [["adress", [["street", "rue de Quimper"], ["town", "Paris"]]], ["age", 12], ["name", "toto"]]]

Extend Array with #to_hash : Recursively convert array to hash

array = [["user", [["adress", [["street", "rue de Quimper"], ["town", "Paris"]]], ["age", 12], ["name", "toto"]]]]
array.to_hash
# =>{"user"=>  {"name"=>"toto", "adress"=>{"street"=>"rue de Quimper", "town"=>"Paris"}, "age"=>12}}

Release 2

Array#move(from,to)

Array#included_in?(array)

Array#duplicates

Array#map_with_index

Array#average

Array#longest