# 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 318
    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
      @built_in_syntax = Syntaxes[@id]
    end

### Public Instance Methods

<=>(other) click to toggle source

    # File lib/active_ldap/schema.rb, line 372
    def <=>(other)
      id <=> other.id
    end

binary?() click to toggle source

    # File lib/active_ldap/schema.rb, line 331
    def binary?
      return true if @built_in_syntax and @built_in_syntax.binary?
      binary_transfer_required? or !human_readable?
    end

binary_transfer_required?() click to toggle source

    # File lib/active_ldap/schema.rb, line 336
    def binary_transfer_required?
      @binary_transfer_required
    end

human_readable?() click to toggle source

    # File lib/active_ldap/schema.rb, line 340
    def human_readable?
      @human_readable
    end

normalize_value(value) click to toggle source

    # File lib/active_ldap/schema.rb, line 364
    def normalize_value(value)
      if @built_in_syntax
        @built_in_syntax.normalize_value(value)
      else
        value
      end
    end

to_param() click to toggle source

    # File lib/active_ldap/schema.rb, line 376
    def to_param
      id
    end

type_cast(value) click to toggle source

    # File lib/active_ldap/schema.rb, line 356
    def type_cast(value)
      if @built_in_syntax
        @built_in_syntax.type_cast(value)
      else
        value
      end
    end

valid?(value) click to toggle source

    # File lib/active_ldap/schema.rb, line 344
    def valid?(value)
      validate(value).nil?
    end

validate(value) click to toggle source

    # File lib/active_ldap/schema.rb, line 348
    def validate(value)
      if @built_in_syntax
        @built_in_syntax.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 381
    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 385
    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