Module ActiveLdap::Ldif::Attribute
In: lib/active_ldap/ldif.rb
Error AttributeAssignmentError AdapterNotSpecified OperationNotPermitted RequiredObjectClassMissed ConnectionError RequiredAttributeMissed LdifInvalid LdapError DistinguishedNameNotSetError EntryNotFound SaveError StrongAuthenticationRequired NotImplemented AdapterNotFound TimeoutError AuthenticationError AttributeValueInvalid EntryNotSaved DistinguishedNameInputInvalid EntryAlreadyExist ObjectClassError UnknownAttribute EntryInvalid DeleteError ConfigurationError ConnectionNotSetup DistinguishedNameInvalid Schema\n[lib/active_ldap/schema.rb\nlib/active_ldap/schema/syntaxes.rb] Base DistinguishedName Reloadable::Deprecated Reloadable::Subclasses Enumerable Ldif Collection EntryAttribute StandardError Children HasMany HasManyWrap BelongsToMany Proxy BelongsTo Normalizable Common Find LDIF Delete Update GetText Parser ActiveRecord::Callbacks ActiveRecord::Validations Base\n[lib/active_ldap/adapter/base.rb\nlib/active_ldap/adapter/jndi.rb\nlib/active_ldap/adapter/ldap.rb\nlib/active_ldap/adapter/net_ldap.rb] Jndi Ldap NetLdap GetTextSupport Xml JndiConnection lib/active_ldap/distinguished_name.rb lib/active_ldap/base.rb lib/active_ldap/xml.rb lib/active_ldap/schema.rb lib/active_ldap/entry_attribute.rb lib/active_ldap/ldif.rb lib/active_ldap/ldap_error.rb LdapBenchmarking ActionController ClassMethods Associations Compatible ClassMethods Tree Acts lib/active_ldap/association/has_many_wrap.rb lib/active_ldap/association/children.rb lib/active_ldap/association/collection.rb lib/active_ldap/association/proxy.rb lib/active_ldap/association/belongs_to_many.rb lib/active_ldap/association/belongs_to.rb lib/active_ldap/association/has_many.rb HasManyUtils Association Populate Command ClassMethods Normalizable Attributes Escape GetTextSupport Update Common ModifyNameRecordLoadable AddOperationModifiable DeleteOperationModifiable ReplaceOperationModifiable ModifyRecordLoadable DeleteRecordLoadable AddRecordLoadable ContentRecordLoadable LDIF Delete Find Operations ClassMethods Configuration lib/active_ldap/get_text/parser.rb GetText ClassMethods Callbacks ClassMethods ObjectClass Validations lib/active_ldap/adapter/jndi_connection.rb lib/active_ldap/adapter/net_ldap.rb lib/active_ldap/adapter/ldap.rb lib/active_ldap/adapter/base.rb lib/active_ldap/adapter/jndi.rb Adapter Helper GetTextFallback ClassMethods HumanReadable Salt UserPassword ClassMethods Connection ActiveLdap dot/m_45_0.png

Methods

Constants

SIZE = 75

Public Instance methods

[Source]

    # File lib/active_ldap/ldif.rb, line 34
34:       def binary_value?(value)
35:         if value.respond_to?(:encoding)
36:           return true if value.encoding == Encoding.find("ascii-8bit")
37:         end
38:         if /\A#{Parser::SAFE_STRING}\z/ =~ value
39:           false
40:         else
41:           true
42:         end
43:       end

[Source]

    # File lib/active_ldap/ldif.rb, line 45
45:       def encode(name, value)
46:         return "#{name}:\n" if value.blank?
47:         result = "#{name}:"
48: 
49:         value = value.to_s unless value.is_a?(String)
50:         if value[-1, 1] == ' ' or binary_value?(value)
51:           result << ":"
52:           value = [value].pack("m").gsub(/\n/, '')
53:         end
54:         result << " "
55: 
56:         first_line_value_size = SIZE - result.size
57:         if value.size > first_line_value_size
58:           first_line_value = value[0, first_line_value_size]
59:           rest_value = value[first_line_value_size..-1]
60:         else
61:           first_line_value = value
62:           rest_value = nil
63:         end
64: 
65:         result << "#{first_line_value}\n"
66:         return result if rest_value.nil?
67: 
68:         rest_value.scan(/.{1,#{SIZE - 1}}/).each do |line| # FIXME
69:           result << " #{line}\n"
70:         end
71:         result
72:       end

[Source]

    # File lib/active_ldap/ldif.rb, line 74
74:       def normalize_value(value, result=[])
75:         case value
76:         when Array
77:           value.each {|val| normalize_value(val, result)}
78:         when Hash
79:           value.each do |option, val|
80:             normalize_value(val).each do |options, v|
81:               result << [[option] + options, v]
82:             end
83:           end
84:           result
85:         else
86:           result << [[], value]
87:         end
88:         result
89:       end

[Validate]