ldif_parser 0.4.0 → 0.5.0
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/lib/entry_maker.rb +2 -2
- data/lib/hash_insensitive.rb +4 -2
- data/lib/ldif_parser.rb +5 -3
- data/lib/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86f7b2757e53b3856dee02c28b75d3007ee67efcb016ad6186392d1b286a9015
|
4
|
+
data.tar.gz: 9e34979e64fbd4c6ba5ea5e08762941c4b136825312a9746d4ee4521cd46b381
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48ab36890e5d8aaa380d809f3f1e8a812f46fc5f01a455c926a21ee4de6746ed17f5c6d37b4649f35170abf46eee798973c0424d27fc6d585ddf6d6b6f39d4fe
|
7
|
+
data.tar.gz: 04fc17e10e1d27487d228d96307acece582f74cb86cdd9ba1159a3c68f026146af5d9ff0beb2f3ff0ef6911be5e09e287881d2475686cbc5c8c064402d805667
|
data/lib/entry_maker.rb
CHANGED
@@ -41,7 +41,7 @@ class LdifParser
|
|
41
41
|
|
42
42
|
def lines_decoded_to_h
|
43
43
|
lines_decoded.each_with_object({}) do |(k, v), h|
|
44
|
-
|
44
|
+
init_hash(h, k)
|
45
45
|
h[k].push(v)
|
46
46
|
end
|
47
47
|
end
|
@@ -59,7 +59,7 @@ class LdifParser
|
|
59
59
|
def line_decoder(line)
|
60
60
|
parts = line.scan(R_LINE_SPLIT).first
|
61
61
|
parts[0] = parts[0].to_sym
|
62
|
-
parts[2] = Base64.decode64(parts[2]).force_encoding('UTF-8') if
|
62
|
+
parts[2] = Base64.decode64(parts[2]).force_encoding('UTF-8') if parts[1] == BASE64_SEPARATOR
|
63
63
|
parts.delete_at(1)
|
64
64
|
parts
|
65
65
|
end
|
data/lib/hash_insensitive.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module HashInsensitive
|
2
4
|
def dn
|
3
5
|
@dn ||= self['dn'].first
|
4
6
|
end
|
5
7
|
|
6
8
|
def insensitive_origin_keys
|
7
|
-
|
9
|
+
keys.select { |key| key.respond_to?(:to_s) }
|
8
10
|
end
|
9
11
|
|
10
12
|
def insensitive_keys
|
@@ -26,4 +28,4 @@ module HashInsensitive
|
|
26
28
|
|
27
29
|
self[insensitive_origin_key]
|
28
30
|
end
|
29
|
-
end
|
31
|
+
end
|
data/lib/ldif_parser.rb
CHANGED
@@ -5,6 +5,8 @@ require_relative 'version'
|
|
5
5
|
|
6
6
|
class LdifParser
|
7
7
|
NEW_LDIF_OBJECT_PATTERN = 'dn'
|
8
|
+
SPACE = ' '
|
9
|
+
DOUBLE_POINT = ':'
|
8
10
|
|
9
11
|
class << self
|
10
12
|
def parse_file(ldif_path, minimized: false, only: [], except: [])
|
@@ -76,13 +78,13 @@ class LdifParser
|
|
76
78
|
end
|
77
79
|
|
78
80
|
def new_ldif_object?(line_key, str, line)
|
79
|
-
line_key == NEW_LDIF_OBJECT_PATTERN && !str.empty? && !line.start_with?(
|
81
|
+
line_key == NEW_LDIF_OBJECT_PATTERN && !str.empty? && !line.start_with?(SPACE)
|
80
82
|
end
|
81
83
|
|
82
84
|
def get_line_key(line, previous_key)
|
83
|
-
return previous_key if line.start_with?(
|
85
|
+
return previous_key if line.start_with?(SPACE)
|
84
86
|
|
85
|
-
line.split(
|
87
|
+
line.split(DOUBLE_POINT).first&.downcase || previous_key
|
86
88
|
end
|
87
89
|
|
88
90
|
def line_has_to_be_excluded?(line_key)
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ldif_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maxime Désécot
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Simple class to parse ldif file
|
14
14
|
email:
|
@@ -32,7 +32,7 @@ metadata:
|
|
32
32
|
homepage_uri: https://github.com/RaoH37/ldif_parser
|
33
33
|
source_code_uri: https://github.com/RaoH37/ldif_parser
|
34
34
|
changelog_uri: https://github.com/RaoH37/ldif_parser
|
35
|
-
post_install_message:
|
35
|
+
post_install_message:
|
36
36
|
rdoc_options: []
|
37
37
|
require_paths:
|
38
38
|
- lib
|
@@ -40,15 +40,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 2.
|
43
|
+
version: '2.7'
|
44
44
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '0'
|
49
49
|
requirements: []
|
50
|
-
rubygems_version: 3.
|
51
|
-
signing_key:
|
50
|
+
rubygems_version: 3.4.19
|
51
|
+
signing_key:
|
52
52
|
specification_version: 4
|
53
53
|
summary: LDIF parser
|
54
54
|
test_files: []
|