ldif_parser 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/entries_maker.rb +10 -5
- data/lib/entry_maker.rb +3 -1
- metadata +3 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2d9ce89e608bd59622021880390f6a5829ae53d29990b81ad98dcad00a9a7186
|
|
4
|
+
data.tar.gz: b7531ad32306bc691dd7cf7a8ad65d45ca3f9a48c5ba36a22fd6287776f63e6e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d902b86d3ee09e122a0f5eba0f862e6510d2973b585ae03991db3e2c9422c1f0fa0025357665e214f22b8076539a15e5fc5df0bd7dedc9913e433c6444c212b5
|
|
7
|
+
data.tar.gz: dce39265633f6e3de7121df6ed4d3e4d6b61c9194a9dcb189e8cd8b362c157f0715eddc452d5099a83a5c19a915ed1797b722ea01124351a249a57b80da1471b
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.
|
|
1
|
+
1.0.2
|
data/lib/entries_maker.rb
CHANGED
|
@@ -5,23 +5,28 @@ require 'base64'
|
|
|
5
5
|
|
|
6
6
|
class LdifParser
|
|
7
7
|
class EntriesMaker
|
|
8
|
-
|
|
8
|
+
R_DN_START = /^dn::?\s+/i
|
|
9
9
|
|
|
10
10
|
class << self
|
|
11
11
|
def parse(input, options = {})
|
|
12
12
|
content = []
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
until input.eof? || !(line = input.readline).empty? || line.start_with?('#')
|
|
15
|
+
next
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
return unless line
|
|
15
19
|
|
|
16
|
-
|
|
20
|
+
content << line if line.match?(R_DN_START)
|
|
17
21
|
|
|
18
|
-
until input.eof? || (line = input.readline).match(
|
|
19
|
-
line.chomp!
|
|
22
|
+
until input.eof? || (line = input.readline).match?(R_DN_START) || line.start_with?('#')
|
|
20
23
|
content << line
|
|
21
24
|
end
|
|
22
25
|
|
|
23
26
|
input.seek(-line.length, IO::SEEK_CUR) if !input.eof? && line
|
|
24
27
|
|
|
28
|
+
content.map(&:chomp!)
|
|
29
|
+
|
|
25
30
|
EntryMaker.new(content.join("\n"), **options).make
|
|
26
31
|
end
|
|
27
32
|
end
|
data/lib/entry_maker.rb
CHANGED
|
@@ -20,7 +20,7 @@ class LdifParser
|
|
|
20
20
|
|
|
21
21
|
def make
|
|
22
22
|
hash = lines_decoded_to_h
|
|
23
|
-
hash[:dn] = hash[:dn]
|
|
23
|
+
hash[:dn] = hash[:dn]&.first
|
|
24
24
|
|
|
25
25
|
if @minimized
|
|
26
26
|
hash.transform_values! do |v|
|
|
@@ -29,6 +29,8 @@ class LdifParser
|
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
hash
|
|
32
|
+
rescue StandardError => _e
|
|
33
|
+
{}
|
|
32
34
|
end
|
|
33
35
|
|
|
34
36
|
private
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ldif_parser
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Maxime Désécot
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies: []
|
|
13
12
|
description: Simple class to parse ldif file
|
|
14
13
|
email:
|
|
@@ -33,7 +32,6 @@ metadata:
|
|
|
33
32
|
homepage_uri: https://github.com/RaoH37/ldif_parser
|
|
34
33
|
source_code_uri: https://github.com/RaoH37/ldif_parser
|
|
35
34
|
changelog_uri: https://github.com/RaoH37/ldif_parser
|
|
36
|
-
post_install_message:
|
|
37
35
|
rdoc_options: []
|
|
38
36
|
require_paths:
|
|
39
37
|
- lib
|
|
@@ -48,8 +46,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
48
46
|
- !ruby/object:Gem::Version
|
|
49
47
|
version: 1.8.11
|
|
50
48
|
requirements: []
|
|
51
|
-
rubygems_version: 3.
|
|
52
|
-
signing_key:
|
|
49
|
+
rubygems_version: 3.6.9
|
|
53
50
|
specification_version: 4
|
|
54
51
|
summary: LDIF parser
|
|
55
52
|
test_files: []
|