Class: ActiveLdap::Schema::Syntax
- Inherits:
-
Entry
- Object
- Entry
- ActiveLdap::Schema::Syntax
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
#initialize(id, schema) ⇒ Syntax
Returns a new instance of Syntax.
315
316
317
318
319
320
321
322
323
324
325
326
|
# File 'lib/active_ldap/schema.rb', line 315
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
@validator = Syntaxes[@id]
end
|
Instance Attribute Details
#length ⇒ Object
Returns the value of attribute length.
314
315
316
|
# File 'lib/active_ldap/schema.rb', line 314
def length
@length
end
|
Instance Method Details
#<=>(other) ⇒ Object
364
365
366
|
# File 'lib/active_ldap/schema.rb', line 364
def <=>(other)
id <=> other.id
end
|
#binary_transfer_required? ⇒ Boolean
328
329
330
|
# File 'lib/active_ldap/schema.rb', line 328
def binary_transfer_required?
@binary_transfer_required
end
|
#human_readable? ⇒ Boolean
332
333
334
|
# File 'lib/active_ldap/schema.rb', line 332
def human_readable?
@human_readable
end
|
#normalize_value(value) ⇒ Object
356
357
358
359
360
361
362
|
# File 'lib/active_ldap/schema.rb', line 356
def normalize_value(value)
if @validator
@validator.normalize_value(value)
else
value
end
end
|
#to_param ⇒ Object
368
369
370
|
# File 'lib/active_ldap/schema.rb', line 368
def to_param
id
end
|
#type_cast(value) ⇒ Object
348
349
350
351
352
353
354
|
# File 'lib/active_ldap/schema.rb', line 348
def type_cast(value)
if @validator
@validator.type_cast(value)
else
value
end
end
|
#valid?(value) ⇒ Boolean
336
337
338
|
# File 'lib/active_ldap/schema.rb', line 336
def valid?(value)
validate(value).nil?
end
|
#validate(value) ⇒ Object
340
341
342
343
344
345
346
|
# File 'lib/active_ldap/schema.rb', line 340
def validate(value)
if @validator
@validator.validate(value)
else
nil
end
end
|