Sha256: f9daeebc6ab4f4415d323df90ebd2ca7835310e3cfc3128adccf37f05497893d
Contents?: true
Size: 414 Bytes
Versions: 1
Compression:
Stored size: 414 Bytes
Contents
require "ostruct" module Paddle 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
paddle-2.2.1 | lib/paddle/object.rb |