Class: ActiveLdap::Schema::Syntaxes::Boolean

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



92
93
94
95
96
97
98
99
100
101
# File 'lib/active_ldap/schema/syntaxes.rb', line 92

def normalize_value(value)
  case value
  when true, "1"
    "TRUE"
  when false, "0"
    "FALSE"
  else
    value
  end
end

#type_cast(value) ⇒ Object



81
82
83
84
85
86
87
88
89
90
# File 'lib/active_ldap/schema/syntaxes.rb', line 81

def type_cast(value)
  case value
  when "TRUE"
    true
  when "FALSE"
    false
  else
    value
  end
end