Sha256: 69ec649b3c23447a33c74eb5c377814cf34c2999733b1fff6194795b285e8721
Contents?: true
Size: 419 Bytes
Versions: 13
Compression:
Stored size: 419 Bytes
Contents
require 'ostruct' module DockHealthApi class Object < OpenStruct def initialize(attributes) super to_ostruct(attributes) end def to_ostruct(obj) if obj.is_a?(Hash) OpenStruct.new(obj.map { |key, val| [key, to_ostruct(val)] }.to_h) elsif obj.is_a?(Array) obj.map { |o| to_ostruct(o) } else # Assumed to be a primitive value obj end end end end
Version data entries
13 entries across 13 versions & 1 rubygems