libpath-ruby 0.2.2.1 → 0.2.2.2
Sign up to get free protection for your applications and to get access to all the features.
- 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 +20 -21
- data/lib/libpath/form/unix.rb +107 -108
- data/lib/libpath/form/windows.rb +206 -193
- 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 +104 -104
- data/lib/libpath/path/windows.rb +98 -98
- data/lib/libpath/path.rb +3 -1
- data/lib/libpath/util/unix.rb +4 -4
- data/lib/libpath/util/windows.rb +4 -4
- data/lib/libpath/util.rb +3 -2
- data/lib/libpath/version.rb +9 -9
- data/test/performance/benchmark_rindex2.rb +7 -7
- 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: d8d3cc14d04488f50a0709403ba13a04673f5436cf2193c329ca213d632098f1
|
4
|
+
data.tar.gz: 19d2d08adfe48b6461ec32a4e4b4d40dfd4eb6c4c3e8852f92926f2aad9c744c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e08138e7acbdf52e0d8e2ceac3bc3d71eb7b421cf79c92258a6091659f02e8ed9c23754549c15b51daf8ffbb229392aff47413d022a9c1bb02c1eb034e3aa90a
|
7
|
+
data.tar.gz: b7ce9f16572ee000607d5844bd6268b00744ea2739ff531ddcefb167a6b795756f18d0224680e2f127eb3fec8639c2085a4e5cbca149cebe77604a56b5497956
|
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: 7th April 2024
|
9
9
|
#
|
10
10
|
# Home: http://github.com/synesissoftware/libpath.Ruby
|
11
11
|
#
|
@@ -51,33 +51,32 @@
|
|
51
51
|
require 'libpath/exceptions/libpath_base_exception'
|
52
52
|
|
53
53
|
|
54
|
-
module LibPath
|
55
|
-
module Exceptions
|
54
|
+
module LibPath
|
55
|
+
module Exceptions
|
56
56
|
|
57
|
-
# Exception thrown when a malformed name is encountered
|
58
|
-
class MalformedNameException < LibPathBaseException
|
57
|
+
# Exception thrown when a malformed name is encountered
|
58
|
+
class MalformedNameException < LibPathBaseException
|
59
59
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
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
|
66
66
|
|
67
|
-
|
67
|
+
unless message
|
68
68
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
super message
|
69
|
+
message = "malformed name '#{name}'"
|
70
|
+
end
|
73
71
|
|
74
|
-
|
75
|
-
end
|
72
|
+
super message
|
76
73
|
|
77
|
-
|
78
|
-
|
79
|
-
end
|
74
|
+
@name = name
|
75
|
+
end
|
80
76
|
|
77
|
+
# (String) The name that is malformed
|
78
|
+
attr_reader :name
|
79
|
+
end
|
81
80
|
end # module Exceptions
|
82
81
|
end # module LibPath
|
83
82
|
|