module Concurrent::ImmutableStruct

def self.included(base)

def self.included(base)
  base.safe_initialization!
end

def self.new(*args, &block)

@!macro struct_new
def self.new(*args, &block)
  clazz_name = nil
  if args.length == 0
    raise ArgumentError.new('wrong number of arguments (0 for 1+)')
  elsif args.length > 0 && args.first.is_a?(String)
    clazz_name = args.shift
  end
  FACTORY.define_struct(clazz_name, args, &block)
end

def ==(other)

@!macro struct_equality
def ==(other)
  ns_equality(other)
end

def [](member)

@!macro struct_get
def [](member)
  ns_get(member)
end

def each(&block)

@!macro struct_each
def each(&block)
  return enum_for(:each) unless block_given?
  ns_each(&block)
end

def each_pair(&block)

@!macro struct_each_pair
def each_pair(&block)
  return enum_for(:each_pair) unless block_given?
  ns_each_pair(&block)
end

def initialize_copy(original)

@!visibility private
def initialize_copy(original)
  super(original)
  ns_initialize_copy
end

def inspect

@!macro struct_inspect
def inspect
  ns_inspect
end

def merge(other, &block)

@!macro struct_merge
def merge(other, &block)
  ns_merge(other, &block)
end

def select(&block)

@!macro struct_select
def select(&block)
  return enum_for(:select) unless block_given?
  ns_select(&block)
end

def to_h

@!macro struct_to_h
def to_h
  ns_to_h
end

def values

@!macro struct_values
def values
  ns_values
end

def values_at(*indexes)

@!macro struct_values_at
def values_at(*indexes)
  ns_values_at(indexes)
end