Class: JSON::LoadProcCaller

Inherits:
Object
  • Object
show all
Defined in:
lib/usamin/overwrite.rb

Class Method Summary collapse

Class Method Details

.load_call_proc(object, proc) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/usamin/overwrite.rb', line 30

def self.load_call_proc(object, proc)
  if object.is_a?(Array)
    object.each{|e| load_call_proc(e, proc)}
  elsif object.is_a?(Hash)
    object.each do |k, v|
      proc.call(k)
      load_call_proc(v, proc)
    end
  end
  proc.call(object)
end