Method: MediaTypes::Scheme::EnumerationOfType#initialize

Defined in:
lib/media_types/scheme/enumeration_of_type.rb

#initialize(item_type, enumeration_type: Array, allow_empty: false) ⇒ EnumerationOfType

An attribute that expects a value of type enumeration_type and each item of type item_type

Parameters:

  • item_type (Class)

    the type of each item

  • enumeration_type (Class) (defaults to: Array)

    the type of the enumeration as a whole

  • allow_empty (TrueClass, FalseClass) (defaults to: false)

    if true, an empty instance of enumeration_type is valid



16
17
18
19
20
21
22
# File 'lib/media_types/scheme/enumeration_of_type.rb', line 16

def initialize(item_type, enumeration_type: Array, allow_empty: false)
  self.item_type = item_type
  self.enumeration_type = enumeration_type
  self.allow_empty = allow_empty

  freeze
end