Sha256: 0c9716fbaf0a1e402b336f5cf2bcc8e8bc58f82a0b5d218641e346a24cd46fa6

Contents?: true

Size: 274 Bytes

Versions: 1

Compression:

Stored size: 274 Bytes

Contents

require 'hashed_struct/version'

class HashedStruct

  def self.new(*fields)
    Struct.new(*fields).tap do |klass|
      klass.class_eval do
        def initialize(options={})
          super(*options.values_at(*self.class.members))
        end
      end
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hashed_struct-0.0.1 lib/hashed_struct.rb