Class: Ldaptic::Syntaxes::Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/ldaptic/syntaxes.rb

Constant Summary collapse

PRINTABLE =

RFC2522 Allows single but not double quotes, and slapd implements the opposite of that. We’ll allow both for now.

"A-Za-z0-9'\"()+,./:? =-"

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object = nil) ⇒ Abstract

The object argument refers back to the LDAP entry from which the attribute in question came. This is currently used only for the DN syntax, to allow dn.find to work.



102
103
104
# File 'lib/ldaptic/syntaxes.rb', line 102

def initialize(object = nil)
  @object = object
end

Class Method Details

.format(object) ⇒ Object



120
121
122
# File 'lib/ldaptic/syntaxes.rb', line 120

def self.format(object)
  new.format(object)
end

.parse(string) ⇒ Object



124
125
126
# File 'lib/ldaptic/syntaxes.rb', line 124

def self.parse(string)
  new.parse(string)
end

Instance Method Details

#error(value) ⇒ Object



117
118
# File 'lib/ldaptic/syntaxes.rb', line 117

def error(value)
end

#format(value) ⇒ Object



113
114
115
# File 'lib/ldaptic/syntaxes.rb', line 113

def format(value)
  Ldaptic.encode(value.kind_of?(Symbol) ? value.to_s : value)
end

#printable?(string) ⇒ Boolean

Returns:



109
110
111
# File 'lib/ldaptic/syntaxes.rb', line 109

def printable?(string)
  string =~ /\A[#{PRINTABLE}]+\z/
end