Class: ActiveLdap::Schema::Syntaxes::BitString — activeldap - ActiveLdap

Class: ActiveLdap::Schema::Syntaxes::BitString

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

Constant Summary

Constant Summary

Constants inherited from Base

ActiveLdap::Schema::Syntaxes::Base::PRINTABLE_CHARACTER, ActiveLdap::Schema::Syntaxes::Base::SYNTAXES, ActiveLdap::Schema::Syntaxes::Base::UNPRINTABLE_CHARACTER

Instance Method Summary (collapse)

Methods inherited from Base

#binary?, #valid?, #validate

Instance Method Details

- (Object) normalize_value(value)



56
57
58
59
60
61
62
# File 'lib/active_ldap/schema/syntaxes.rb', line 56

def normalize_value(value)
  if value.is_a?(String) and /\A[01]*\z/ =~ value
    "'#{value}'B"
  else
    value
  end
end

- (Object) type_cast(value)



47
48
49
50
51
52
53
54
# File 'lib/active_ldap/schema/syntaxes.rb', line 47

def type_cast(value)
  return nil if value.nil?
  if /\A'([01]*)'B\z/ =~ value.to_s
    $1
  else
    value
  end
end