Skip to content

Commit

Permalink
dcell:server: own implementation of inplace keys symbolization
Browse files Browse the repository at this point in the history
  • Loading branch information
niamster committed Dec 14, 2014
1 parent 72c66b2 commit e59f893
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/dcell/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ def handle_message(message)

class InvalidMessageError < StandardError; end # undecodable message

def symbolize!(msg)
return unless msg.kind_of? Hash
msg.symbolize_keys!
msg.each_value do |val|
def symbolize!(h)
return unless h.kind_of? Hash
h.keys.each do |k|
ks = k.to_sym
val = h.delete k
h[ks] = val
if val.kind_of? Hash
symbolize! val
elsif val.kind_of? Array
Expand Down

0 comments on commit e59f893

Please sign in to comment.