Sha256: 7684bd0ad5bad0b84369e17295a69cdb0483b332a109a1b9be343df219ee43e1

Contents?: true

Size: 133 Bytes

Versions: 4

Compression:

Stored size: 133 Bytes

Contents

class Struct
	def to_h
    Hash[
      self.class.members.each{|m| [m.to_sym, self[m]]}
    ]
  end unless method_defined? :to_h
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
backports-3.0.3 lib/backports/2.0.0/struct.rb
backports-3.0.2 lib/backports/2.0.0/struct.rb
backports-3.0.1 lib/backports/2.0.0/struct.rb
backports-3.0.0 lib/backports/2.0.0/struct.rb