Class: LdapConverters::ArrayOfJSON
- Inherits:
-
ArrayValue
- Object
- Base
- ArrayValue
- LdapConverters::ArrayOfJSON
- Defined in:
- lib/ldap_converters.rb
Overview
Convert LDAP Array of JSON strings to array of ruby objects
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary (collapse)
Methods inherited from ArrayValue
Methods inherited from Base
Constructor Details
This class inherits a constructor from LdapConverters::Base
Instance Method Details
- (Object) read(value)
97 98 99 100 101 102 103 104 105 |
# File 'lib/ldap_converters.rb', line 97 def read(value) Array(value).map do |n| begin JSON.parse(n) rescue JSON::ParserError JSON::ParserError end end.select{|v| v != JSON::ParserError} end |
- (Object) write(value)
107 108 109 |
# File 'lib/ldap_converters.rb', line 107 def write(value) Array(value).map{|v| v.to_json} end |