Class: Ldap::LdapArray
- Inherits:
-
DataMapper::Property::Text
- Object
- DataMapper::Property::Text
- Ldap::LdapArray
- Defined in:
- lib/ldap/array.rb
Instance Method Summary collapse
- #custom? ⇒ Boolean
- #dump(value) ⇒ Object
-
#initialize(_model = nil, _name = nil, options = {}, *args) ⇒ LdapArray
constructor
keep the *args so it works for both DM-1.1.x and DM-1.0.x.
- #load(value) ⇒ Object
- #primitive?(value) ⇒ Boolean
Constructor Details
#initialize(_model = nil, _name = nil, options = {}, *args) ⇒ LdapArray
keep the *args so it works for both DM-1.1.x and DM-1.0.x
78 79 80 81 82 83 |
# File 'lib/ldap/array.rb', line 78 def initialize(_model = nil, _name = nil, = {}, *args) super add_writer(model,name) unless [:writer] == :private || [:accessor] == :private add_reader(model,name) unless [:reader] == :private || [:accessor] == :private end |
Instance Method Details
#custom? ⇒ Boolean
50 51 52 |
# File 'lib/ldap/array.rb', line 50 def custom? true end |
#dump(value) ⇒ Object
67 68 69 70 71 72 73 74 75 |
# File 'lib/ldap/array.rb', line 67 def dump(value) result = case value when LdapArray then '"' + value.join('","') + '"' when ::Array then '"' + value.join('","') + '"' when ::String then '"' + value.to_s + '"' else nil end end |
#load(value) ⇒ Object
58 59 60 61 62 63 64 65 |
# File 'lib/ldap/array.rb', line 58 def load(value) result = case value when ::String then value[1, value.size-2].split('","').to_a.freeze when ::Array then value.freeze else [] end end |
#primitive?(value) ⇒ Boolean
54 55 56 |
# File 'lib/ldap/array.rb', line 54 def primitive?(value) super || value.kind_of?(::Array) end |