Module: PassiveLDAP::Types

Defined in:
lib/passiveldap.rb

Overview

some type constants that may be used as the :type parameter of an attribute declaration

Currently available types:

  • ANSI_Date, which will convert an ANSI date number to a human readable time string. This type is read only, so there is only a :from conversion specified here. There may be a few hours of difference, because of time zone errors. This should be fixed.

  • Epoch_Date, which will convert an epoch date to a human readable time string.

Constant Summary collapse

ANSI_Date =

– 116444700000000000: miliseconds between 1601-01-01 and 1970-01-01. Or something like that No error checking. Will throw errors at dates like “infinity”

RDoc has an error parsing the document if the constant Hash below is split through separate lines, and if I use do..end instead of { }. The parsing goes wrong even if the Hash contains the word “end”. That is why I ende up using the ?: operator and putting the whole value into one line ++

{ :from => Proc.new { |s| (s.nil? or s=="" or s=="0") ? "unused" : Time.at((Integer(s) - 116444700000000000) / 10000000).to_s } }
Epoch_Date =
{ :from => Proc.new { |s| Time.at(s.to_i).to_s } }