class ActiveLdap::Schema::Syntax

Attributes

length[R]

Public Class Methods

new(id, schema) click to toggle source
Calls superclass method ActiveLdap::Schema::Entry.new
# File lib/active_ldap/schema.rb, line 317
def initialize(id, schema)
  if /\{(\d+)\}\z/ =~ id
    id = $PREMATCH
    @length = Integer($1)
  else
    @length = nil
  end
  super(id, schema, "ldapSyntaxes")
  @id = id
  @name = nil if @name == @id
  @validator = Syntaxes[@id]
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/active_ldap/schema.rb, line 366
def <=>(other)
  id <=> other.id
end
binary_transfer_required?() click to toggle source
# File lib/active_ldap/schema.rb, line 330
def binary_transfer_required?
  @binary_transfer_required
end
human_readable?() click to toggle source
# File lib/active_ldap/schema.rb, line 334
def human_readable?
  @human_readable
end
normalize_value(value) click to toggle source
# File lib/active_ldap/schema.rb, line 358
def normalize_value(value)
  if @validator
    @validator.normalize_value(value)
  else
    value
  end
end
to_param() click to toggle source
# File lib/active_ldap/schema.rb, line 370
def to_param
  id
end
type_cast(value) click to toggle source
# File lib/active_ldap/schema.rb, line 350
def type_cast(value)
  if @validator
    @validator.type_cast(value)
  else
    value
  end
end
valid?(value) click to toggle source
# File lib/active_ldap/schema.rb, line 338
def valid?(value)
  validate(value).nil?
end
validate(value) click to toggle source
# File lib/active_ldap/schema.rb, line 342
def validate(value)
  if @validator
    @validator.validate(value)
  else
    nil
  end
end

Private Instance Methods

attribute(attribute_name, name=@name) click to toggle source
# File lib/active_ldap/schema.rb, line 375
def attribute(attribute_name, name=@name)
  @schema.ldap_syntax_attribute(name, attribute_name)
end
collect_info() click to toggle source
# File lib/active_ldap/schema.rb, line 379
def collect_info
  @description = attribute("DESC")[0]
  @binary_transfer_required =
    (attribute('X-BINARY-TRANSFER-REQUIRED')[0] == 'TRUE')
  @human_readable = (attribute('X-NOT-HUMAN-READABLE')[0] != 'TRUE')
end