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\-]*/u
- SAFE_CHAR =
/[\x01-\x09\x0B-\x0C\x0E-\x7F]/u
- SAFE_INIT_CHAR =
/[\x01-\x09\x0B-\x0C\x0E-\x1F\x21-\x39\x3B\x3D-\x7F]/u
- SAFE_STRING =
/#{SAFE_INIT_CHAR}#{SAFE_CHAR}*/u
- FILL =
/ */u
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.
84 85 86 |
# File 'lib/active_ldap/ldif.rb', line 84 def ldif @ldif end |
Instance Method Details
#parse ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/active_ldap/ldif.rb', line 96 def parse return @ldif if @ldif @scanner = Scanner.new(@source) raise version_spec_is_missing unless @scanner.scan(/version:/u) @scanner.scan(FILL) version = @scanner.scan(/\d+/u) 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 |