Method: BBLib::SimpleInit::ClassMethods#init_type

Defined in:
lib/bblib/core/mixins/simple_init.rb

#init_type(type = nil) ⇒ Object

Sets or returns the current init type for this class. Available types are:

> :strict = Unknown named arguments will raise an error.

> :loose = Unknown named arguments are ignored.

Raises:

  • (ArgumentError)


141
142
143
144
145
# File 'lib/bblib/core/mixins/simple_init.rb', line 141

def init_type(type = nil)
  return @init_type ||= _super_init_type unless type
  raise ArgumentError, "Unknown init type '#{type}'. Must be #{INIT_TYPES.join_terms('or', encapsulate: "'")}." unless INIT_TYPES.include?(type)
  @init_type = type
end