Module ActiveLdap::Ldif::Attribute
In: lib/active_ldap/ldif.rb
Error AttributeAssignmentError AdapterNotSpecified OperationNotPermitted RequiredObjectClassMissed ConnectionError RequiredAttributeMissed LdifInvalid LdapError DistinguishedNameNotSetError EntryNotFound SaveError StrongAuthenticationRequired 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] DistinguishedName Base Reloadable::Deprecated Reloadable::Subclasses Enumerable Ldif Collection EntryAttribute StandardError Children HasManyWrap HasMany BelongsToMany Proxy BelongsTo Common Find LDIF Delete Update Normalizable 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 Compatible ClassMethods Associations LdapBenchmarking ActionController Populate 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 ClassMethods Tree Acts Command Update Common ModifyNameRecordLoadable AddOperationModifiable DeleteOperationModifiable ReplaceOperationModifiable ModifyRecordLoadable DeleteRecordLoadable AddRecordLoadable ContentRecordLoadable LDIF Delete Find Operations GetTextSupport Escape ClassMethods Normalizable Attributes ClassMethods Configuration ClassMethods ObjectClass lib/active_ldap/get_text/parser.rb GetText ClassMethods Callbacks 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/jndi.rb Adapter Helper GetTextFallback ClassMethods HumanReadable Salt UserPassword ClassMethods Connection ActiveLdap dot/m_46_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:         if value[-1, 1] == ' ' or binary_value?(value)
50:           result << ":"
51:           value = [value].pack("m").gsub(/\n/, '')
52:         end
53:         result << " "
54: 
55:         first_line_value_size = SIZE - result.size
56:         if value.size > first_line_value_size
57:           first_line_value = value[0, first_line_value_size]
58:           rest_value = value[first_line_value_size..-1]
59:         else
60:           first_line_value = value
61:           rest_value = nil
62:         end
63: 
64:         result << "#{first_line_value}\n"
65:         return result if rest_value.nil?
66: 
67:         rest_value.scan(/.{1,#{SIZE - 1}}/).each do |line| # FIXME
68:           result << " #{line}\n"
69:         end
70:         result
71:       end

[Source]

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

[Validate]