Class: ActiveLdap::Schema::Syntaxes::Integer

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

Constant Summary

Constants inherited from Base

Base::PRINTABLE_CHARACTER, Base::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



245
246
247
248
249
250
251
# File 'lib/active_ldap/schema/syntaxes.rb', line 245

def normalize_value(value)
  if value.is_a?(::Integer)
    value.to_s
  else
    value
  end
end

#type_cast(value) ⇒ Object



236
237
238
239
240
241
242
243
# File 'lib/active_ldap/schema/syntaxes.rb', line 236

def type_cast(value)
  return value if value.nil?
  begin
    Integer(value)
  rescue ArgumentError
    value
  end
end