Sha256: 25b5ad1d312a21caa05d3e97ce364193ee19a376fb48b050e74537bd1d91383d
Contents?: true
Size: 615 Bytes
Versions: 1
Compression:
Stored size: 615 Bytes
Contents
module EncryptedFormFields module Dfs extend self def traverse(value, &block) if value.respond_to?(:each_pair) traverse_hash(value, &block) elsif value.is_a?(Array) traverse_array(value, &block) else yield value end end private def traverse_hash(hash, &block) result = {}.with_indifferent_access hash.each_pair do |key, value| result[key] = traverse(value, &block) end result 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.1 | lib/encrypted_form_fields/dfs.rb |