could i provoke slight steep typing?


hopefully i haven't misunderstood definition "duck typing", nonetheless i've read, means i should formula formed an vigilant responds methods rather type/class is.



here's code:



def convert_hash(hash)
hash.keys.all? { |k| k.is_a?(integer) }
relapse hash
elsif hash.keys.all? { |k| k.is_a?(property) }
new_hash = {}
hash.each_pair {|k,v| new_hash[k.id] = v}
relapse new_hash
else
lift "custom charge keys should id's ability objects"
end
end


what i wish certain i finish adult crush where keys an integer representing id an activerecord object. i don't quite humour carrying iterate by crush keys twice all? establish i need squeeze id's out.



of course, i'll accept any suggestions provoke formula good :)



Comments

Popular posts from this blog

list macos calm editors formula editors

how hibernate @any-related annotations?

using mvc, should hoop communication between views? between models?