Class: ActiveLdap::Schema::Syntax — activeldap - ActiveLdap

Class: ActiveLdap::Schema::Syntax

Inherits:
Entry
  • Object
show all
Defined in:
lib/active_ldap/schema.rb

Instance Attribute Summary (collapse)

Attributes inherited from Entry

#aliases, #description, #id, #name

Instance Method Summary (collapse)

Methods inherited from Entry

#eql?, #hash

Constructor Details

- (Syntax) initialize(id, schema)

Returns a new instance of Syntax



318
319
320
321
322
323
324
325
326
327
328
329
# 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

Instance Attribute Details

- (Object) length (readonly)

Returns the value of attribute length



317
318
319
# File 'lib/active_ldap/schema.rb', line 317

def length
  @length
end

Instance Method Details

- (Object) <=>(other)



372
373
374
# File 'lib/active_ldap/schema.rb', line 372

def <=>(other)
  id <=> other.id
end

- (Boolean) binary?

Returns:

  • (Boolean)


331
332
333
334
# 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

- (Boolean) binary_transfer_required?

Returns:

  • (Boolean)


336
337
338
# File 'lib/active_ldap/schema.rb', line 336

def binary_transfer_required?
  @binary_transfer_required
end

- (Boolean) human_readable?

Returns:

  • (Boolean)


340
341
342
# File 'lib/active_ldap/schema.rb', line 340

def human_readable?
  @human_readable
end

- (Object) normalize_value(value)



364
365
366
367
368
369
370
# 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

- (Object) to_param



376
377
378
# File 'lib/active_ldap/schema.rb', line 376

def to_param
  id
end

- (Object) type_cast(value)



356
357
358
359
360
361
362
# 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

- (Boolean) valid?(value)

Returns:

  • (Boolean)


344
345
346
# File 'lib/active_ldap/schema.rb', line 344

def valid?(value)
  validate(value).nil?
end

- (Object) validate(value)



348
349
350
351
352
353
354
# File 'lib/active_ldap/schema.rb', line 348

def validate(value)
  if @built_in_syntax
    @built_in_syntax.validate(value)
  else
    nil
  end
end