Sha256: e68615aff0cca02b31873b33e6e7386bc4cc7a40036773fd01f46c5f42b4fb79

Contents?: true

Size: 321 Bytes

Versions: 6

Compression:

Stored size: 321 Bytes

Contents

class OpenStruct
  def self.to_hash(object, hash = {})
    case object
    when OpenStruct then
      object.each_pair do |key, value|
        hash[key.to_s] = to_hash(value)
      end
      hash
    when Array then
      object.collect do |value|
        to_hash(value)
      end
    else
      object
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
vps-0.3.1 lib/vps/core_ext/ostruct.rb
vps-0.2.3 lib/vps/core_ext/ostruct.rb
vps-0.2.2 lib/vps/core_ext/ostruct.rb
vps-0.2.1 lib/vps/core_ext/ostruct.rb
vps-0.2.0 lib/vps/core_ext/ostruct.rb
vps-0.1.2 lib/vps/core_ext/ostruct.rb