Class: ActiveValidation::Decorators::DisallowsDuplicatesRegistry

Inherits:
ActiveValidation::Decorator show all
Defined in:
lib/active_validation/decorators/disallows_duplicates_registry.rb

Instance Method Summary collapse

Methods inherited from ActiveValidation::Decorator

const_missing, #initialize, #method_missing, #respond_to_missing?, #send

Constructor Details

This class inherits a constructor from ActiveValidation::Decorator

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ActiveValidation::Decorator

Instance Method Details

#==(other) ⇒ Object



12
13
14
# File 'lib/active_validation/decorators/disallows_duplicates_registry.rb', line 12

def ==(other)
  object_id == other.object_id
end

#register(name, item) ⇒ Object



6
7
8
9
10
# File 'lib/active_validation/decorators/disallows_duplicates_registry.rb', line 6

def register(name, item)
  return @component.register(name, item) unless registered?(name)

  raise Errors::DuplicateRegistryEntryError, "#{@component.name} already registered: #{name}"
end