Class: LDAP::Control

### Home Classes Methods

### In Files

- lib/ldap/control.rb

### Parent

Object

### Methods

- ::encode
- #decode

### Class/Module Index

Quicksearch

- LDAP
- LDAP::Conn
- LDAP::Control
- LDAP::Entry
- LDAP::LDIF
- LDAP::LDIF::Entry
- LDAP::LDIF::LDIFError
- LDAP::LDIF::Mod
- LDAP::Mod
- LDAP::Record
- LDAP::Schema

No matching classes.

# LDAP::Control

### Public Class Methods

encode( *vals ) click to toggle source

Take `vals`, produce an Array of values in ASN.1 format and then convert the Array to DER.

    # File lib/ldap/control.rb, line 18
    def Control.encode( *vals )
      encoded_vals = []

      vals.each do |val|
        encoded_vals <<
          case val
          when Integer
            OpenSSL::ASN1::Integer( val )
          when String
            OpenSSL::ASN1::OctetString.new( val )
          else
            # What other types may exist?
          end
      end

      OpenSSL::ASN1::Sequence.new( encoded_vals ).to_der
    end

### Public Instance Methods

decode() click to toggle source

Take an Array of ASN.1 data and return an Array of decoded values.

    # File lib/ldap/control.rb, line 39
    def decode
      values = []

      OpenSSL::ASN1::decode( self.value ).value.each do |val|
        values << val.value
      end

      values
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.