Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

ruby hash except nested

Hash[nested_hash.map {|k,v| [k,(v.respond_to?(:except)?v.except("nested_key2"):v)] }]

=> {"key1"=>"value1", "key2"=>{"nested_key1"=>"nestedvalue1"}}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #ruby #hash #nested
ADD COMMENT
Topic
Name
5+7 =