Class: ActiveLdap::Ldif::Parser
- Inherits:
-
Object
- Object
- ActiveLdap::Ldif::Parser
- Includes:
- GetTextSupport
- Defined in:
- lib/active_ldap/ldif.rb
Constant Summary collapse
- ATTRIBUTE_TYPE_CHARS =
/[a-zA-Z][a-zA-Z0-9\-]*/
- SAFE_CHAR =
/[\x01-\x09\x0B-\x0C\x0E-\x7F]/
- SAFE_INIT_CHAR =
/[\x01-\x09\x0B-\x0C\x0E-\x1F\x21-\x39\x3B\x3D-\x7F]/
- SAFE_STRING =
/#{SAFE_INIT_CHAR}#{SAFE_CHAR}*/
- FILL =
/ */
Instance Attribute Summary collapse
-
#ldif ⇒ Object
readonly
Returns the value of attribute ldif.
Instance Method Summary collapse
-
#initialize(source) ⇒ Parser
constructor
A new instance of Parser.
- #parse ⇒ Object
Methods included from GetTextSupport
Constructor Details
Instance Attribute Details
#ldif ⇒ Object (readonly)
Returns the value of attribute ldif.
95 96 97 |
# File 'lib/active_ldap/ldif.rb', line 95 def ldif @ldif end |
Instance Method Details
#parse ⇒ Object
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/active_ldap/ldif.rb', line 107 def parse return @ldif if @ldif @scanner = Scanner.new(@source) raise version_spec_is_missing unless @scanner.scan(/version:/) @scanner.scan(FILL) version = @scanner.scan(/\d+/) raise version_number_is_missing if version.nil? version = Integer(version) raise unsupported_version(version) if version != 1 raise separator_is_missing unless @scanner.scan_separators records = parse_records @ldif = LDIF.new(records) end |