Class: ActiveInteractor::Type::List
- Defined in:
- lib/active_interactor/type/list.rb
Instance Method Summary collapse
-
#initialize(type) ⇒ List
constructor
rubocop:disable Lint/MissingSuper.
- #valid?(value) ⇒ Boolean
Methods inherited from Base
Constructor Details
#initialize(type) ⇒ List
rubocop:disable Lint/MissingSuper
6 7 8 |
# File 'lib/active_interactor/type/list.rb', line 6 def initialize(type) # rubocop:disable Lint/MissingSuper @type = type end |
Instance Method Details
#valid?(value) ⇒ Boolean
10 11 12 13 14 15 16 |
# File 'lib/active_interactor/type/list.rb', line 10 def valid?(value) return false unless value.is_a?(Array) value.all? do |element| element.nil? || element.is_a?(@type) || (@type.is_a?(ActiveInteractor::Type::Base) && @type.valid?(element)) end end |