Class: LdapConverters::StringBoolean

Inherits:
Base
  • Object
show all
Defined in:
lib/ldap_converters.rb

Overview

Convert string style booleans "TRUE" and "FALSE" to real ruby booleans

Instance Attribute Summary

Attributes inherited from Base

#model

Instance Method Summary (collapse)

Methods inherited from Base

#initialize, #validate

Constructor Details

This class inherits a constructor from LdapConverters::Base

Instance Method Details

- (Object) read(value)



73
74
75
76
77
78
79
80
81
82
# File 'lib/ldap_converters.rb', line 73

def read(value)
  case Array(value).first
  when "TRUE"
    true
  when "FALSE"
    false
  else
    nil
  end
end

- (Object) write(value)



84
85
86
87
88
89
90
# File 'lib/ldap_converters.rb', line 84

def write(value)
  if value
    "TRUE"
  else
    "FALSE"
  end
end