Class: ParamsDeserializer::AttributeCollection

Inherits:
Array
  • Object
show all
Defined in:
lib/params_deserializers/attribute_collection.rb

Defined Under Namespace

Classes: NameCollisionError

Instance Method Summary collapse

Instance Method Details

#<<(new_attr) ⇒ Object



34
35
36
37
38
39
40
41
# File 'lib/params_deserializers/attribute_collection.rb', line 34

def <<(new_attr)
  if any? { |attr| attr.name == new_attr.name }
    raise NameCollisionError,
          "Attribute \"#{new_attr.name}\" was defined multiple times."
  end

  super
end

#unignoredObject



43
44
45
# File 'lib/params_deserializers/attribute_collection.rb', line 43

def unignored
  reject(&:ignored)
end