module StructCast

Constants

VERSION

Public Instance Methods

Struct(args) click to toggle source
# File lib/struct_cast.rb, line 35
def Struct(args)
  hash = args.convert_to_hash.symbolize_keys

  if hash.empty?
    ::Struct.new(nil, keyword_init: true).new
  else
    ::Struct.new(*hash.keys, keyword_init: true).new(**hash)
  end
end