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

#valid?, #validate

Methods included from GetTextSupport

included

Instance Method Details

#normalize_value(value) ⇒ Object



52
53
54
55
56
57
58
# File 'lib/active_ldap/schema/syntaxes.rb', line 52

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

#type_cast(value) ⇒ Object



43
44
45
46
47
48
49
50
# File 'lib/active_ldap/schema/syntaxes.rb', line 43

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