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

Methods inherited from Generic

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

Constructor Details

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

Instance Method Details

#with_type(definition = nil, &block) ⇒ Object



40
41
42
43
# File 'lib/easy_params/types/collection.rb', line 40

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