libpath-ruby 0.2.2.1 → 0.2.2.3
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/README.md +1 -1
- data/lib/libpath/constants/unix.rb +66 -66
- data/lib/libpath/constants/windows.rb +67 -67
- data/lib/libpath/constants.rb +3 -2
- data/lib/libpath/diagnostics/parameter_checking.rb +2 -1
- data/lib/libpath/exceptions/libpath_base_exception.rb +12 -13
- data/lib/libpath/exceptions/malformed_name_exception.rb +21 -22
- data/lib/libpath/form/unix.rb +110 -111
- data/lib/libpath/form/windows.rb +208 -195
- data/lib/libpath/form.rb +2 -3
- data/lib/libpath/internal_/array.rb +48 -48
- data/lib/libpath/internal_/platform.rb +26 -27
- data/lib/libpath/internal_/string.rb +22 -17
- data/lib/libpath/internal_/unix/form.rb +118 -113
- data/lib/libpath/internal_/windows/drive.rb +76 -71
- data/lib/libpath/internal_/windows/form.rb +206 -195
- data/lib/libpath/libpath.rb +1 -1
- data/lib/libpath/path/unix.rb +106 -106
- data/lib/libpath/path/windows.rb +101 -101
- data/lib/libpath/path.rb +3 -1
- data/lib/libpath/util/unix.rb +7 -7
- data/lib/libpath/util/windows.rb +7 -7
- data/lib/libpath/util.rb +3 -2
- data/lib/libpath/version.rb +9 -9
- data/test/performance/benchmark_rindex2.rb +7 -7
- data/test/unit/exceptions/tc_malformed_name_exception.rb +2 -2
- data/test/unit/path/tc_path.rb +0 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8996094361fb92d0b95118bea46f4e1652000d3ed54e5008895df5a7260bbd00
|
4
|
+
data.tar.gz: 613922a5a2d51de42327585ce3f23a0ebcb6f3d19d1b1066e3c9a54832412af9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab2efbb8ace8b969c0d2f79bc42058a512aa6633d710e8fa3108f3400fbffc8b5d10bd76e30cb64234815524c9d32b3e4dac50aa6702b8175803764da204efd4
|
7
|
+
data.tar.gz: 227a0622eab1ea0da0d0d27ee7913fc7114c4ae00fcbd2ffc872eafcfd6017759d9b97a9597f59029223d63610ace45205c240db4a0f9d59dc988653d3333421
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
# Purpose: LibPath::Constants::Unix module
|
5
5
|
#
|
6
6
|
# Created: 29th January 2019
|
7
|
-
# Updated:
|
7
|
+
# Updated: 7th April 2024
|
8
8
|
#
|
9
9
|
# Home: http://github.com/synesissoftware/libpath.Ruby
|
10
10
|
#
|
@@ -47,95 +47,95 @@
|
|
47
47
|
=begin
|
48
48
|
=end
|
49
49
|
|
50
|
-
module LibPath
|
51
|
-
module Constants
|
52
|
-
module Unix
|
50
|
+
module LibPath
|
51
|
+
module Constants
|
52
|
+
module Unix
|
53
53
|
|
54
|
-
# Module defining instance functions that will be included and extended into
|
55
|
-
# any class or module including/extending module LibPath::Constants::Unix
|
56
|
-
module LibPath_Constants_Unix_Methods
|
54
|
+
# Module defining instance functions that will be included and extended into
|
55
|
+
# any class or module including/extending module LibPath::Constants::Unix
|
56
|
+
module LibPath_Constants_Unix_Methods
|
57
57
|
|
58
|
-
|
59
|
-
|
58
|
+
# Defines invalid characters
|
59
|
+
module InvalidCharacters
|
60
60
|
|
61
|
-
|
62
|
-
|
61
|
+
# Innately invalid characters
|
62
|
+
module Innate
|
63
63
|
|
64
|
-
|
65
|
-
|
64
|
+
# The list of characters
|
65
|
+
LIST = [
|
66
66
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
67
|
+
"\0",
|
68
|
+
]
|
69
|
+
# The regular expression
|
70
|
+
RE = /[#{LIST.map { |m| Regexp.escape m }.join}]/
|
71
|
+
end # module Innate
|
72
72
|
|
73
|
-
|
74
|
-
|
73
|
+
# Valid path name separator characters
|
74
|
+
module PathNameSeparators
|
75
75
|
|
76
|
-
|
77
|
-
|
76
|
+
# The list of characters
|
77
|
+
LIST = [
|
78
78
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
79
|
+
'/',
|
80
|
+
]
|
81
|
+
# The regular expression
|
82
|
+
RE = /[#{LIST.map { |m| Regexp.escape m }.join}]/
|
83
|
+
end # module PathNameSeparators
|
84
84
|
|
85
|
-
|
86
|
-
|
85
|
+
# Valid path separator characters
|
86
|
+
module PathSeparators
|
87
87
|
|
88
|
-
|
89
|
-
|
88
|
+
# The list of characters
|
89
|
+
LIST = [
|
90
90
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
91
|
+
':',
|
92
|
+
]
|
93
|
+
# The regular expression
|
94
|
+
RE = /[#{LIST.map { |m| Regexp.escape m }.join}]/
|
95
|
+
end # module PathSeparators
|
96
96
|
|
97
|
-
|
98
|
-
|
97
|
+
# Invalid shell characters
|
98
|
+
module Shell
|
99
99
|
|
100
|
-
|
101
|
-
|
100
|
+
# The list of characters
|
101
|
+
LIST = [
|
102
102
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
end # module LibPath_Constants_Unix_Methods
|
103
|
+
'*',
|
104
|
+
'<',
|
105
|
+
'>',
|
106
|
+
'?',
|
107
|
+
'|',
|
108
|
+
]
|
109
|
+
# The regular expression
|
110
|
+
RE = /[#{LIST.map { |m| Regexp.escape m }.join}]/
|
111
|
+
end # module Shell
|
112
|
+
end # module InvalidCharacters
|
113
|
+
end # module LibPath_Constants_Unix_Methods
|
114
114
|
|
115
|
-
# @!visibility private
|
116
|
-
def self.extended receiver # :nodoc:
|
115
|
+
# @!visibility private
|
116
|
+
def self.extended receiver # :nodoc:
|
117
117
|
|
118
|
-
|
118
|
+
receiver.class_eval do
|
119
119
|
|
120
|
-
|
120
|
+
extend LibPath_Constants_Unix_Methods
|
121
|
+
end
|
122
|
+
|
123
|
+
$stderr.puts "#{receiver} extended by #{LibPath_Constants_Unix_Methods}" if $DEBUG
|
121
124
|
end
|
122
125
|
|
123
|
-
|
124
|
-
|
126
|
+
# @!visibility private
|
127
|
+
def self.included receiver # :nodoc:
|
125
128
|
|
126
|
-
|
127
|
-
def self.included receiver # :nodoc:
|
129
|
+
receiver.class_eval do
|
128
130
|
|
129
|
-
|
131
|
+
include LibPath_Constants_Unix_Methods
|
132
|
+
end
|
130
133
|
|
131
|
-
|
134
|
+
$stderr.puts "#{receiver} included #{LibPath_Constants_Unix_Methods}" if $DEBUG
|
132
135
|
end
|
133
136
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
extend LibPath_Constants_Unix_Methods
|
138
|
-
include LibPath_Constants_Unix_Methods
|
137
|
+
extend LibPath_Constants_Unix_Methods
|
138
|
+
include LibPath_Constants_Unix_Methods
|
139
139
|
|
140
140
|
end # module Unix
|
141
141
|
end # module Constants
|
@@ -4,7 +4,7 @@
|
|
4
4
|
# Purpose: LibPath::Constants::Windows module
|
5
5
|
#
|
6
6
|
# Created: 29th January 2019
|
7
|
-
# Updated:
|
7
|
+
# Updated: 7th April 2024
|
8
8
|
#
|
9
9
|
# Home: http://github.com/synesissoftware/libpath.Ruby
|
10
10
|
#
|
@@ -47,96 +47,96 @@
|
|
47
47
|
=begin
|
48
48
|
=end
|
49
49
|
|
50
|
-
module LibPath
|
51
|
-
module Constants
|
52
|
-
module Windows
|
50
|
+
module LibPath
|
51
|
+
module Constants
|
52
|
+
module Windows
|
53
53
|
|
54
|
-
# Module defining instance functions that will be included and extended into
|
55
|
-
# any class or module including/extending module LibPath::Constants::Windows
|
56
|
-
module LibPath_Constants_Windows_Details
|
54
|
+
# Module defining instance functions that will be included and extended into
|
55
|
+
# any class or module including/extending module LibPath::Constants::Windows
|
56
|
+
module LibPath_Constants_Windows_Details
|
57
57
|
|
58
|
-
|
59
|
-
|
58
|
+
# Defines invalid characters
|
59
|
+
module InvalidCharacters
|
60
60
|
|
61
|
-
|
62
|
-
|
61
|
+
# Innately invalid characters
|
62
|
+
module Innate
|
63
63
|
|
64
|
-
|
65
|
-
|
64
|
+
# The list of characters
|
65
|
+
LIST = [
|
66
66
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
67
|
+
"\0",
|
68
|
+
]
|
69
|
+
# The regular expression
|
70
|
+
RE = /[#{LIST.map { |m| Regexp.escape m }.join}]/
|
71
|
+
end # module Innate
|
72
72
|
|
73
|
-
|
74
|
-
|
73
|
+
# Valid path name separator characters
|
74
|
+
module PathNameSeparators
|
75
75
|
|
76
|
-
|
77
|
-
|
76
|
+
# The list of characters
|
77
|
+
LIST = [
|
78
78
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
79
|
+
"\\",
|
80
|
+
'/',
|
81
|
+
]
|
82
|
+
# The regular expression
|
83
|
+
RE = /[#{LIST.map { |m| Regexp.escape m }.join}]/
|
84
|
+
end # module PathNameSeparators
|
85
85
|
|
86
|
-
|
87
|
-
|
86
|
+
# Valid path separator characters
|
87
|
+
module PathSeparators
|
88
88
|
|
89
|
-
|
90
|
-
|
89
|
+
# The list of characters
|
90
|
+
LIST = [
|
91
91
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
92
|
+
';',
|
93
|
+
]
|
94
|
+
# The regular expression
|
95
|
+
RE = /[#{LIST.map { |m| Regexp.escape m }.join}]/
|
96
|
+
end # module PathSeparators
|
97
97
|
|
98
|
-
|
99
|
-
|
98
|
+
# Invalid shell characters
|
99
|
+
module Shell
|
100
100
|
|
101
|
-
|
102
|
-
|
101
|
+
# The list of characters
|
102
|
+
LIST = [
|
103
103
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
end # module LibPath_Constants_Windows_Details
|
104
|
+
'*',
|
105
|
+
'<',
|
106
|
+
'>',
|
107
|
+
'?',
|
108
|
+
'|',
|
109
|
+
]
|
110
|
+
# The regular expression
|
111
|
+
RE = /[#{LIST.map { |m| Regexp.escape m }.join}]/
|
112
|
+
end # module Shell
|
113
|
+
end # module InvalidCharacters
|
114
|
+
end # module LibPath_Constants_Windows_Details
|
115
115
|
|
116
|
-
# @!visibility private
|
117
|
-
def self.extended receiver # :nodoc:
|
116
|
+
# @!visibility private
|
117
|
+
def self.extended receiver # :nodoc:
|
118
118
|
|
119
|
-
|
119
|
+
receiver.class_eval do
|
120
120
|
|
121
|
-
|
121
|
+
extend LibPath_Constants_Windows_Details
|
122
|
+
end
|
123
|
+
|
124
|
+
$stderr.puts "#{receiver} extended by #{LibPath_Constants_Windows_Details}" if $DEBUG
|
122
125
|
end
|
123
126
|
|
124
|
-
|
125
|
-
|
127
|
+
# @!visibility private
|
128
|
+
def self.included receiver # :nodoc:
|
126
129
|
|
127
|
-
|
128
|
-
def self.included receiver # :nodoc:
|
130
|
+
receiver.class_eval do
|
129
131
|
|
130
|
-
|
132
|
+
include LibPath_Constants_Windows_Details
|
133
|
+
end
|
131
134
|
|
132
|
-
|
135
|
+
$stderr.puts "#{receiver} included #{LibPath_Constants_Windows_Details}" if $DEBUG
|
133
136
|
end
|
134
137
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
extend LibPath_Constants_Windows_Details
|
139
|
-
include LibPath_Constants_Windows_Details
|
138
|
+
extend LibPath_Constants_Windows_Details
|
139
|
+
include LibPath_Constants_Windows_Details
|
140
140
|
|
141
141
|
end # module Windows
|
142
142
|
end # module Constants
|
data/lib/libpath/constants.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# Purpose: LibPathBaseException class
|
6
6
|
#
|
7
7
|
# Created: 30th January 2019
|
8
|
-
# Updated:
|
8
|
+
# Updated: 7th April 2024
|
9
9
|
#
|
10
10
|
# Home: http://github.com/synesissoftware/libpath.Ruby
|
11
11
|
#
|
@@ -48,27 +48,26 @@
|
|
48
48
|
=begin
|
49
49
|
=end
|
50
50
|
|
51
|
-
module LibPath
|
52
|
-
module Exceptions
|
51
|
+
module LibPath
|
52
|
+
module Exceptions
|
53
53
|
|
54
|
-
# Root exception for all LibPath exceptions
|
55
|
-
#
|
56
|
-
# NOTE: this class is abstract
|
57
|
-
class LibPathBaseException < StandardError
|
54
|
+
# Root exception for all LibPath exceptions
|
55
|
+
#
|
56
|
+
# NOTE: this class is abstract
|
57
|
+
class LibPathBaseException < StandardError
|
58
58
|
|
59
59
|
=begin
|
60
60
|
|
61
|
-
|
61
|
+
# TODO include Xqsr3's WithCause
|
62
62
|
=end
|
63
63
|
|
64
|
-
|
64
|
+
def self.new *args
|
65
65
|
|
66
|
-
|
66
|
+
raise NoMethodError, "private method `new' called for #{self}:Class" if self == LibPathBaseException
|
67
67
|
|
68
|
-
|
68
|
+
super
|
69
|
+
end
|
69
70
|
end
|
70
|
-
end
|
71
|
-
|
72
71
|
end # module Exceptions
|
73
72
|
end # module LibPath
|
74
73
|
|
@@ -5,7 +5,7 @@
|
|
5
5
|
# Purpose: MalformedNameException class
|
6
6
|
#
|
7
7
|
# Created: 30th January 2019
|
8
|
-
# Updated:
|
8
|
+
# Updated: 13th April 2024
|
9
9
|
#
|
10
10
|
# Home: http://github.com/synesissoftware/libpath.Ruby
|
11
11
|
#
|
@@ -45,39 +45,38 @@
|
|
45
45
|
# ######################################################################## #
|
46
46
|
|
47
47
|
|
48
|
+
require 'libpath/exceptions/libpath_base_exception'
|
49
|
+
|
50
|
+
|
48
51
|
=begin
|
49
52
|
=end
|
50
53
|
|
51
|
-
|
54
|
+
module LibPath
|
55
|
+
module Exceptions
|
52
56
|
|
57
|
+
# Exception thrown when a malformed name is encountered
|
58
|
+
class MalformedNameException < LibPathBaseException
|
53
59
|
|
54
|
-
|
55
|
-
|
60
|
+
# Initialises an instance from the given +name+ and optional +message+
|
61
|
+
#
|
62
|
+
# * *Parameters:*
|
63
|
+
# - +name+ (String) The name that is malformed
|
64
|
+
# - +message+ (String) {optional} The message. If +nil+ the message "malformed name '#{name}'" is used
|
65
|
+
def initialize name, message = nil
|
56
66
|
|
57
|
-
|
58
|
-
class MalformedNameException < LibPathBaseException
|
67
|
+
unless message
|
59
68
|
|
60
|
-
|
61
|
-
|
62
|
-
# * *Parameters:*
|
63
|
-
# - +name+ (String) The name that is malformed
|
64
|
-
# - +message+ (String) {optional} The message. If +nil+ the message "malformed name '#{name}'" is used
|
65
|
-
def initialize name, message = nil
|
69
|
+
message = "malformed name '#{name}'"
|
70
|
+
end
|
66
71
|
|
67
|
-
|
72
|
+
super message
|
68
73
|
|
69
|
-
|
74
|
+
@name = name
|
70
75
|
end
|
71
76
|
|
72
|
-
|
73
|
-
|
74
|
-
@name = name
|
77
|
+
# (String) The name that is malformed
|
78
|
+
attr_reader :name
|
75
79
|
end
|
76
|
-
|
77
|
-
# (String) The name that is malformed
|
78
|
-
attr_reader :name
|
79
|
-
end
|
80
|
-
|
81
80
|
end # module Exceptions
|
82
81
|
end # module LibPath
|
83
82
|
|