Module | Jpmobile::Util |
In: |
lib/jpmobile/util.rb
|
# File lib/jpmobile/util.rb, line 5 5: def deep_apply(obj, &proc) 6: case obj 7: when Hash 8: obj.each_pair do |key, value| 9: obj[key] = deep_apply(value, &proc) 10: end 11: when Array 12: obj.collect!{|value| deep_apply(value, &proc)} 13: when NilClass, TrueClass, FalseClass, Tempfile, StringIO 14: return obj 15: else 16: obj = obj.to_param if obj.respond_to?(:to_param) 17: proc.call(obj) 18: end 19: end