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

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

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

Methods included from GetTextSupport

included

Instance Method Details

#normalize_value(value) ⇒ Object



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

#type_cast(value) ⇒ Object



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