Class: ROM::LDAP::Schema::TypeBuilder Private

Inherits:
Object
  • Object
show all
Extended by:
Initializer
Defined in:
lib/rom/ldap/schema/type_builder.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

ATTRIBUTE TYPE

An attribute type is a schema element that correlates an OID and a set of names with an attribute syntax and a set of matching rules.

The components of an attribute type definition include:

- An OID used to uniquely identify the attribute type.
- A set of zero or more names that can be used to more easily reference the attribute type.
- An optional equality matching rule that specifies how equality matching
  should be performed on values of that attribute.
  If no equality matching rule is specified, then the default equality rule
  for the associated attribute syntax will be used.
  If the associated syntax doesn't have a default equality matching rule,
  then equality operations will not be allowed for that attribute.
- An optional ordering matching rule that specifies how ordering operations
  should be performed on values of that attribute.
  If no ordering matching rule is specified, then the default ordering rule
  for the associated attribute syntax will be used.
  If the associated syntax doesn't have a default ordering matching rule,
  then ordering operations will not be allowed for that attribute.
- An optional substring matching rule that specifies how substring matching
  should be performed on values of that attribute.
  If no substring matching rule is specified, then the default substring rule
  for the associated attribute syntax will be used.
  If the associated syntax doesn't have a default substring matching rule,
  then substring operations will not be allowed for that attribute.
- An optional syntax OID that specifies the syntax for values of the attribute.
  If no syntax is specified, then it will default to the directory string syntax.
- A flag that indicates whether the attribute is allowed to have multiple values.
- An optional attribute usage string indicating the context in which the attribute is to be used.
- An optional flag that indicates whether the attribute can be modified by external clients.

See Also:

  • Directory.attributes

API:

  • private

Instance Method Summary collapse

Instance Method Details

#call(attribute_name, schema) ⇒ Object

Parameters:

  • Relation schema object.

API:

  • public



62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/rom/ldap/schema/type_builder.rb', line 62

def call(attribute_name, schema)
  attribute = find_attribute(attribute_name)
  primitive = map_type(attribute)
  ruby_type = Types.const_get(primitive)
  read_type = !attribute[:single] ? Types.const_get(Inflector.pluralize(primitive)) : ruby_type

  ruby_type.meta(
    **attribute,
    source:   schema,
    name:     attribute_name,
    read:     read_type.meta(oid: attribute[:oid])
  )
end