Class: EasyParams::Types::StructsCollection

Inherits:
Collection show all
Defined in:
lib/easy_params/types/collection.rb

Overview

base interface for array of structs type

Instance Method Summary collapse

Methods inherited from Collection

#coerce, #default, #each, #initialize, #normalize, #of, optional

Methods inherited from Generic

#array?, #coerce, #default, #initialize, #normalize, #optional, #optional?

Constructor Details

This class inherits a constructor from EasyParams::Types::Collection

Instance Method Details

#with_type(&block) ⇒ Object



44
45
46
47
# File 'lib/easy_params/types/collection.rb', line 44

def with_type(&block)
  of_type = Class.new(EasyParams::Types::Struct.class).tap { |c| c.class_eval(&block) }.new
  self.class.new(@title, @default, @normalize_proc, of: of_type)
end