Sha256: 055583b65cb29a7cd7b0129edf4a165d9df8d1bc6f568ce4c3b706c90e586a4d

Contents?: true

Size: 270 Bytes

Versions: 6

Compression:

Stored size: 270 Bytes

Contents

module OpenStructToHash
  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
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
albacore-0.2.5 lib/albacore/support/openstruct.rb
albacore-0.2.4 lib/albacore/support/openstruct.rb
albacore-0.2.3 lib/albacore/support/openstruct.rb
albacore-0.2.2 lib/albacore/support/openstruct.rb
albacore-0.2.0.preview2 lib/albacore/support/openstruct.rb
albacore-0.2.0.preview1 lib/albacore/support/openstruct.rb