Class: EditInPlace::FieldTypeRegistrar

Inherits:
Registrar
  • Object
show all
Defined in:
lib/edit_in_place/field_type_registrar.rb

Overview

FieldTypeRegistrar is a subcalss of Registrar that only allows FieldType instances to be registered.

Author:

  • Jacob Lockard

Since:

  • 0.1.0

Instance Attribute Summary

Attributes inherited from Registrar

#registrations

Instance Method Summary collapse

Methods inherited from Registrar

#all, #dup, #find, #initialize, #register, #register_all

Constructor Details

This class inherits a constructor from EditInPlace::Registrar

Instance Method Details

#validate_registration!(name, field_type) ⇒ void (protected)

This method returns an undefined value.

Adds to the default `validate_registration!` implementation by ensuring that only EditInPlace::FieldType instances can be registered.

Parameters:

  • name (Symbol)

    the name to validate.

  • field_type (FieldType)

    the field type to validate.

Raises:

Since:

  • 0.1.0


17
18
19
20
# File 'lib/edit_in_place/field_type_registrar.rb', line 17

def validate_registration!(name, field_type)
  super
  raise InvalidFieldTypeError, field_type unless field_type.is_a? FieldType
end