Sha256: 7b9be9e562e7fae29a7342da5ec3558f9f5962a759ca54dfb402bf3c39f3ebbe

Contents?: true

Size: 270 Bytes

Versions: 1

Compression:

Stored size: 270 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
michaeldwan-urban-mapping-api-0.9.3 lib/core_ext.rb