6 kyu

Make Ruby Hashes Act Like JavaScript Objects

125 of 126bellmyer

Description:

Upgrade Ruby's Hash class to work like a JavaScript Object. For example:

hash = {:five => 5, :ten => 10}
hash.five  #=> 5

hash.fifteen = 15
hash[:fifteen]  #=> 15

This should work for any Ruby hash, both setting and getting values. For simplicity's sake, don't worry about supporting string keys, only symbols.

Refactoring

Stats:

CreatedNov 11, 2014
PublishedNov 11, 2014
Warriors Trained394
Total Skips64
Total Code Submissions413
Total Times Completed126
Ruby Completions125
Total Stars9
% of votes with a positive feedback rating89% of 36
Total "Very Satisfied" Votes30
Total "Somewhat Satisfied" Votes4
Total "Not Satisfied" Votes2
Ad
Contributors
  • bellmyer Avatar
  • myjinxin2015 Avatar
Ad