Module: OpenStructToHash

Defined in:
lib/albacore/support/openstruct.rb

Instance Method Summary collapse

Instance Method Details

#to_hashObject



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/albacore/support/openstruct.rb', line 2

def to_hash
  # from: http://snippets.dzone.com/posts/show/7312
  h = @table
  # handles nested structures
  h.each do |k,v|
    if v.class == OpenStruct
      h[k] = v._to_hash
    end
  end
  return h
end