Sha256: 9e904073923a387af3d80c8c495de096b517b6d4735454deef5b6a46a3c27f10

Contents?: true

Size: 259 Bytes

Versions: 1

Compression:

Stored size: 259 Bytes

Contents

class Object
 def to_openstruct
   self
 end
end

class Array
 def to_openstruct
   map{ |el| el.to_openstruct }
 end
end

class Hash
 def to_openstruct
   mapped = {}
   each{ |key,value| mapped[key] = value.to_openstruct }
   OpenStruct.new(mapped)
 end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shorty-0.1.2 lib/shorty/to_openstruct.rb