Sha256: 0cfc225f5783f550b0b58ab7eb0ddca158ba6f225a1be47316ce092bc3067323

Contents?: true

Size: 363 Bytes

Versions: 1

Compression:

Stored size: 363 Bytes

Contents

# frozen_string_literal: true

module SiteHealth
  # Enhance Struct to work with keywords
  class KeyStruct < Struct
    def initialize(**keyword_args)
      keyword_args.each do |key, value|
        unless members.include?(key)
          raise ArgumentError, "Unknown key struct member: #{key}"
        end

        self[key] = value
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
site_health-0.2.0 lib/site_health/key_struct.rb