Skip to content

anoiaque/ruby_extensions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Extends some ruby core classes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages