Sha256: 8af8e3c799e72a319f55fd822e5377110711a01e4b560d5d7fce8f716184203a
Contents?: true
Size: 598 Bytes
Versions: 1
Compression:
Stored size: 598 Bytes
Contents
module EncryptedFormFields module Dfs extend self def traverse(value, &block) if value.is_a?(Hash) traverse_hash(value, &block) elsif value.is_a?(Array) traverse_array(value, &block) else yield value end end private def traverse_hash(hash, &block) hash.inject({}.with_indifferent_access) do |result, (key, value)| result[key] = traverse(value, &block) result end end def traverse_array(array, &block) array.map do |value| traverse(value, &block) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
encrypted_form_fields-0.2.0 | lib/encrypted_form_fields/dfs.rb |