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
data/lib/libpath/path/unix.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# Purpose: LibPath::Path::Unix module
|
6
6
|
#
|
7
7
|
# Created: 21st January 2019
|
8
|
-
# Updated:
|
8
|
+
# Updated: 13th April 2024
|
9
9
|
#
|
10
10
|
# Home: http://github.com/synesissoftware/libpath.Ruby
|
11
11
|
#
|
@@ -45,125 +45,125 @@
|
|
45
45
|
# ######################################################################## #
|
46
46
|
|
47
47
|
|
48
|
-
=begin
|
49
|
-
=end
|
50
|
-
|
51
48
|
require 'libpath/diagnostics'
|
52
49
|
require 'libpath/internal_/unix/form'
|
53
50
|
require 'libpath/util/unix'
|
54
51
|
|
55
52
|
|
56
|
-
|
57
|
-
|
58
|
-
module Unix # :nodoc:
|
59
|
-
|
60
|
-
# Class representing a parsed path (for UNIX)
|
61
|
-
class ParsedPath
|
62
|
-
|
63
|
-
# @!visibility private
|
64
|
-
module ParsedPath_Constants # :nodoc: all
|
65
|
-
|
66
|
-
INIT_VALID_OPTIONS = %i{ home locator pwd }
|
67
|
-
INIT_MPA_COMMON_OPTIONS = %i{ home locator pwd }
|
68
|
-
INIT_DRP_COMMON_OPTIONS = %i{ home locator pwd }
|
69
|
-
end
|
70
|
-
|
71
|
-
# Initialises an instance from the given +path+, optional
|
72
|
-
# +search_directory+ and options
|
73
|
-
#
|
74
|
-
# === Signature
|
75
|
-
#
|
76
|
-
# * *Parameters:*
|
77
|
-
# - +path+ (String) The path. May not be +nil+
|
78
|
-
# - +search_directory+ (String) The search_directory, from which the relative attributes are calculated for the path. May be +nil+
|
79
|
-
# - +options+ (Hash) Options
|
80
|
-
#
|
81
|
-
# * *Options:*
|
82
|
-
# - +????+
|
83
|
-
#
|
84
|
-
# * *Exceptions:*
|
85
|
-
# - +ArgumentError+ Raised if +path+ is +nil+
|
86
|
-
def initialize path, search_directory = nil, **options
|
87
|
-
|
88
|
-
raise ::ArgumentError, "path may not be nil or empty" if path.nil? || path.empty?
|
89
|
-
|
90
|
-
_Diagnostics = ::LibPath::Diagnostics
|
91
|
-
_Internal_Form = ::LibPath::Internal_::Unix::Form
|
92
|
-
_Util = ::LibPath::Util::Unix
|
93
|
-
_C = ::LibPath::Path::Unix::ParsedPath::ParsedPath_Constants
|
94
|
-
|
95
|
-
_Diagnostics.check_options(options, known: _C::INIT_VALID_OPTIONS)
|
96
|
-
|
97
|
-
|
98
|
-
abs_path = _Util.make_path_absolute(path, make_canonical: true, **options.select { |k| _C::INIT_MPA_COMMON_OPTIONS.include?(k) })
|
99
|
-
|
100
|
-
_, _, f2_dir, f3_basename, f4_stem, f5_ext, f6_dir_parts, _ = _Internal_Form.split_path(abs_path)
|
53
|
+
=begin
|
54
|
+
=end
|
101
55
|
|
102
|
-
|
103
|
-
|
104
|
-
@compare_path = _Util.make_compare_path abs_path
|
105
|
-
@directory = f2_dir
|
106
|
-
@directory_path = f2_dir
|
107
|
-
@directory_parts = f6_dir_parts
|
56
|
+
module LibPath
|
57
|
+
module Path
|
108
58
|
|
109
|
-
|
110
|
-
@file_name_only = f4_stem
|
111
|
-
@file_extension = f5_ext
|
59
|
+
module Unix
|
112
60
|
|
113
|
-
|
61
|
+
# Class representing a parsed path (for UNIX)
|
62
|
+
class ParsedPath
|
114
63
|
|
115
|
-
|
64
|
+
# @!visibility private
|
65
|
+
module ParsedPath_Constants # :nodoc: all
|
116
66
|
|
117
|
-
|
118
|
-
|
67
|
+
INIT_VALID_OPTIONS = %i{ home locator pwd }
|
68
|
+
INIT_MPA_COMMON_OPTIONS = %i{ home locator pwd }
|
69
|
+
INIT_DRP_COMMON_OPTIONS = %i{ home locator pwd }
|
70
|
+
end
|
119
71
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
72
|
+
# Initialises an instance from the given +path+, optional
|
73
|
+
# +search_directory+ and options
|
74
|
+
#
|
75
|
+
# === Signature
|
76
|
+
#
|
77
|
+
# * *Parameters:*
|
78
|
+
# - +path+ (String) The path. May not be +nil+
|
79
|
+
# - +search_directory+ (String) The search_directory, from which the relative attributes are calculated for the path. May be +nil+
|
80
|
+
# - +options+ (Hash) Options
|
81
|
+
#
|
82
|
+
# * *Options:*
|
83
|
+
# - +????+
|
84
|
+
#
|
85
|
+
# * *Exceptions:*
|
86
|
+
# - +ArgumentError+ Raised if +path+ is +nil+
|
87
|
+
def initialize path, search_directory = nil, **options
|
88
|
+
|
89
|
+
raise ::ArgumentError, "path may not be nil or empty" if path.nil? || path.empty?
|
90
|
+
|
91
|
+
_Diagnostics = ::LibPath::Diagnostics
|
92
|
+
_Internal_Form = ::LibPath::Internal_::Unix::Form
|
93
|
+
_Util = ::LibPath::Util::Unix
|
94
|
+
_C = ::LibPath::Path::Unix::ParsedPath::ParsedPath_Constants
|
95
|
+
|
96
|
+
_Diagnostics.check_options(options, known: _C::INIT_VALID_OPTIONS)
|
97
|
+
|
98
|
+
|
99
|
+
abs_path = _Util.make_path_absolute(path, make_canonical: true, **options.select { |k| _C::INIT_MPA_COMMON_OPTIONS.include?(k) })
|
100
|
+
|
101
|
+
_, _, f2_dir, f3_basename, f4_stem, f5_ext, f6_dir_parts, _ = _Internal_Form.split_path(abs_path)
|
102
|
+
|
103
|
+
@given_path = path
|
104
|
+
@absolute_path = abs_path
|
105
|
+
@compare_path = _Util.make_compare_path abs_path
|
106
|
+
@directory = f2_dir
|
107
|
+
@directory_path = f2_dir
|
108
|
+
@directory_parts = f6_dir_parts
|
109
|
+
|
110
|
+
@file_full_name = f3_basename
|
111
|
+
@file_name_only = f4_stem
|
112
|
+
@file_extension = f5_ext
|
113
|
+
|
114
|
+
if search_directory
|
115
|
+
|
116
|
+
drp_options = options.select { |k| _C::INIT_DRP_COMMON_OPTIONS.include?(k) }
|
117
|
+
|
118
|
+
search_directory = _Util.make_path_absolute(search_directory, make_canonical: true, **options.select { |k| _C::INIT_MPA_COMMON_OPTIONS.include?(k) })
|
119
|
+
search_directory = _Internal_Form.append_trailing_slash search_directory
|
120
|
+
|
121
|
+
@search_directory = search_directory
|
122
|
+
@search_relative_path = _Util.derive_relative_path(search_directory, abs_path, **drp_options)
|
123
|
+
@search_relative_path = _Internal_Form.append_trailing_slash(@search_relative_path) if _Internal_Form.char_is_path_name_separator?(abs_path[-1])
|
124
|
+
@search_relative_directory_path = _Internal_Form.append_trailing_slash _Util.derive_relative_path(search_directory, f2_dir, **drp_options)
|
125
|
+
@search_relative_directory_parts = @search_relative_directory_path.split('/').map { |v| v + '/' }
|
126
|
+
end
|
125
127
|
end
|
126
|
-
end
|
127
128
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
129
|
+
# (String) The path given to initialise the instance
|
130
|
+
attr_reader :given_path
|
131
|
+
# (String) The full-path of the instance
|
132
|
+
attr_reader :absolute_path
|
133
|
+
# (String) A normalised form of #path that can be used in comparisons
|
134
|
+
attr_reader :compare_path
|
135
|
+
# (String) The entry's directory (excluding the #drive if on Windows)
|
136
|
+
attr_reader :directory
|
137
|
+
# (String) The full path of the entry's directory
|
138
|
+
attr_reader :directory_path
|
139
|
+
alias_method :dirname, :directory_path
|
140
|
+
# ([String]) An array of directory parts, where each part ends in the path name separator
|
141
|
+
attr_reader :directory_parts
|
142
|
+
# (String) The entry's file name (combination of #stem + #extension)
|
143
|
+
attr_reader :file_full_name
|
144
|
+
alias_method :basename, :file_full_name
|
145
|
+
# (String) The entry's file stem
|
146
|
+
attr_reader :file_name_only
|
147
|
+
alias_method :stem, :file_name_only
|
148
|
+
# (String) The entry's file extension
|
149
|
+
attr_reader :file_extension
|
150
|
+
alias_method :extension, :file_extension
|
151
|
+
# (String) The search directory if specified; +nil+ otherwise
|
152
|
+
attr_reader :search_directory
|
153
|
+
# (String) The #path relative to #search_directory; +nil+ if no search directory specified
|
154
|
+
attr_reader :search_relative_path
|
155
|
+
# (String) The #directory_path relative to #search_directory; +nil+ if no search directory specified
|
156
|
+
attr_reader :search_relative_directory_path
|
157
|
+
# ([String]) The #directory_parts relative to #search_directory; +nil+ if no search directory specified
|
158
|
+
attr_reader :search_relative_directory_parts
|
159
|
+
|
160
|
+
# (String) String form of path
|
161
|
+
def to_s
|
162
|
+
|
163
|
+
absolute_path
|
164
|
+
end
|
163
165
|
end
|
164
|
-
end
|
165
|
-
|
166
|
-
end # module Unix
|
166
|
+
end # module Unix
|
167
167
|
end # module Path
|
168
168
|
end # module LibPath
|
169
169
|
|
data/lib/libpath/path/windows.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# Purpose: LibPath::Path::Windows module
|
6
6
|
#
|
7
7
|
# Created: 21st January 2019
|
8
|
-
# Updated:
|
8
|
+
# Updated: 13th April 2024
|
9
9
|
#
|
10
10
|
# Home: http://github.com/synesissoftware/libpath.Ruby
|
11
11
|
#
|
@@ -45,131 +45,131 @@
|
|
45
45
|
# ######################################################################## #
|
46
46
|
|
47
47
|
|
48
|
-
=begin
|
49
|
-
=end
|
50
|
-
|
51
48
|
require 'libpath/diagnostics'
|
52
49
|
require 'libpath/internal_/windows/form'
|
53
50
|
require 'libpath/util/windows'
|
54
51
|
|
55
52
|
|
56
|
-
|
57
|
-
|
58
|
-
module Windows # :nodoc:
|
53
|
+
=begin
|
54
|
+
=end
|
59
55
|
|
60
|
-
|
61
|
-
|
56
|
+
module LibPath
|
57
|
+
module Path
|
62
58
|
|
63
|
-
|
64
|
-
module ParsedPath_Constants # :nodoc: all
|
59
|
+
module Windows
|
65
60
|
|
66
|
-
|
67
|
-
|
68
|
-
INIT_DRP_COMMON_OPTIONS = %i{ home locator pwd }
|
69
|
-
end
|
61
|
+
# Class representing a parsed path (for Windows)
|
62
|
+
class ParsedPath
|
70
63
|
|
71
|
-
|
72
|
-
|
73
|
-
#
|
74
|
-
# === Signature
|
75
|
-
#
|
76
|
-
# * *Parameters:*
|
77
|
-
# - +path+ (String) The path. May not be +nil+
|
78
|
-
# - +search_directory+ (String) The search_directory, from which the relative attributes are calculated for the path. May be +nil+
|
79
|
-
# - +options+ (Hash) Options
|
80
|
-
#
|
81
|
-
# * *Options:*
|
82
|
-
# - +????+
|
83
|
-
#
|
84
|
-
# * *Exceptions:*
|
85
|
-
# - +ArgumentError+ Raised if +path+ is +nil+
|
86
|
-
def initialize path, search_directory = nil, **options
|
64
|
+
# @!visibility private
|
65
|
+
module ParsedPath_Constants # :nodoc: all
|
87
66
|
|
88
|
-
|
67
|
+
INIT_VALID_OPTIONS = %i{ home locator pwd }
|
68
|
+
INIT_MPA_COMMON_OPTIONS = %i{ home locator pwd }
|
69
|
+
INIT_DRP_COMMON_OPTIONS = %i{ home locator pwd }
|
70
|
+
end
|
71
|
+
|
72
|
+
# Initialises an instance from the given +path+, optional
|
73
|
+
# +search_directory+ and options
|
74
|
+
#
|
75
|
+
# === Signature
|
76
|
+
#
|
77
|
+
# * *Parameters:*
|
78
|
+
# - +path+ (String) The path. May not be +nil+
|
79
|
+
# - +search_directory+ (String) The search_directory, from which the relative attributes are calculated for the path. May be +nil+
|
80
|
+
# - +options+ (Hash) Options
|
81
|
+
#
|
82
|
+
# * *Options:*
|
83
|
+
# - +????+
|
84
|
+
#
|
85
|
+
# * *Exceptions:*
|
86
|
+
# - +ArgumentError+ Raised if +path+ is +nil+
|
87
|
+
def initialize path, search_directory = nil, **options
|
88
|
+
|
89
|
+
raise ::ArgumentError, "path may not be nil or empty" if path.nil? || path.empty?
|
89
90
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
91
|
+
_Diagnostics = ::LibPath::Diagnostics
|
92
|
+
_Internal_Form = ::LibPath::Internal_::Windows::Form
|
93
|
+
_Util = ::LibPath::Util::Windows
|
94
|
+
_C = ::LibPath::Path::Windows::ParsedPath::ParsedPath_Constants
|
94
95
|
|
95
|
-
|
96
|
+
_Diagnostics.check_options(options, known: _C::INIT_VALID_OPTIONS)
|
96
97
|
|
97
98
|
|
98
|
-
|
99
|
+
abs_path = _Util.make_path_absolute(path, make_canonical: true, **options.select { |k| _C::INIT_MPA_COMMON_OPTIONS.include?(k) })
|
99
100
|
|
100
|
-
|
101
|
+
splits = _Internal_Form.split_path(abs_path)
|
101
102
|
|
102
|
-
|
103
|
+
_, f1_vol, f2_dir, f3_basename, f4_stem, f5_ext, f6_dir_parts, _f7_abs_parts = *splits
|
103
104
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
105
|
+
@given_path = path
|
106
|
+
@absolute_path = abs_path
|
107
|
+
@compare_path = _Util.make_compare_path abs_path, splits: splits
|
108
|
+
@volume = f1_vol
|
109
|
+
@directory = f2_dir
|
110
|
+
@directory_path = "#{f1_vol}#{f2_dir}"
|
111
|
+
@directory_parts = f6_dir_parts
|
111
112
|
|
112
|
-
|
113
|
-
|
114
|
-
|
113
|
+
@file_full_name = f3_basename
|
114
|
+
@file_name_only = f4_stem
|
115
|
+
@file_extension = f5_ext
|
115
116
|
|
116
|
-
|
117
|
+
if search_directory
|
117
118
|
|
118
|
-
|
119
|
+
drp_options = options.select { |k| _C::INIT_DRP_COMMON_OPTIONS.include?(k) }
|
119
120
|
|
120
|
-
|
121
|
-
|
121
|
+
search_directory = _Util.make_path_canonical search_directory, make_slashes_canonical: true
|
122
|
+
search_directory = _Internal_Form.append_trailing_slash search_directory
|
122
123
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
124
|
+
@search_directory = search_directory
|
125
|
+
@search_relative_path = _Util.derive_relative_path(search_directory, abs_path, **drp_options)
|
126
|
+
@search_relative_path = _Internal_Form.append_trailing_slash(@search_relative_path) if _Internal_Form.char_is_path_name_separator?(abs_path[-1])
|
127
|
+
@search_relative_directory_path = _Internal_Form.append_trailing_slash _Util.derive_relative_path(search_directory, "#{f1_vol}#{f2_dir}", **drp_options)
|
128
|
+
@search_relative_directory_parts = @search_relative_directory_path.split('\\').map { |v| v + '\\' }
|
129
|
+
end
|
128
130
|
end
|
129
|
-
end
|
130
131
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
132
|
+
# (String) The path given to initialise the instance
|
133
|
+
attr_reader :given_path
|
134
|
+
# (String) The full-path of the instance
|
135
|
+
attr_reader :absolute_path
|
136
|
+
# (String) A normalised form of #path that can be used in comparisons
|
137
|
+
attr_reader :compare_path
|
138
|
+
# (String) The Windows volume, which may be a drive, or a UNC specification
|
139
|
+
attr_reader :volume
|
140
|
+
# (String) The entry's directory (excluding the #drive if on Windows)
|
141
|
+
attr_reader :directory
|
142
|
+
# (String) The full path of the entry's directory (taking into account the
|
143
|
+
# #drive if on Windows)
|
144
|
+
attr_reader :directory_path
|
145
|
+
alias_method :dirname, :directory_path
|
146
|
+
# ([String]) An array of directory parts, where each part ends in the path name separator
|
147
|
+
attr_reader :directory_parts
|
148
|
+
# (String) The entry's file name (combination of #stem + #extension)
|
149
|
+
attr_reader :file_full_name
|
150
|
+
alias_method :basename, :file_full_name
|
151
|
+
# (String) The entry's file stem
|
152
|
+
attr_reader :file_name_only
|
153
|
+
alias_method :stem, :file_name_only
|
154
|
+
# (String) The entry's file extension
|
155
|
+
attr_reader :file_extension
|
156
|
+
alias_method :extension, :file_extension
|
157
|
+
# (String) The search directory if specified; +nil+ otherwise
|
158
|
+
attr_reader :search_directory
|
159
|
+
# (String) The #path relative to #search_directory; +nil+ if no search directory specified
|
160
|
+
attr_reader :search_relative_path
|
161
|
+
# (String) The #directory_path relative to #search_directory; +nil+ if no search directory specified
|
162
|
+
attr_reader :search_relative_directory_path
|
163
|
+
# ([String]) The #directory_parts relative to #search_directory; +nil+ if no search directory specified
|
164
|
+
attr_reader :search_relative_directory_parts
|
165
|
+
|
166
|
+
# (String) String form of path
|
167
|
+
def to_s
|
168
|
+
|
169
|
+
absolute_path
|
170
|
+
end
|
169
171
|
end
|
170
|
-
end
|
171
|
-
|
172
|
-
end # module Windows
|
172
|
+
end # module Windows
|
173
173
|
end # module Path
|
174
174
|
end # module LibPath
|
175
175
|
|
data/lib/libpath/path.rb
CHANGED
data/lib/libpath/util/unix.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# Purpose: LibPath::Util::Unix module
|
6
6
|
#
|
7
7
|
# Created: 14th January 2019
|
8
|
-
# Updated:
|
8
|
+
# Updated: 13th April 2024
|
9
9
|
#
|
10
10
|
# Home: http://github.com/synesissoftware/libpath.Ruby
|
11
11
|
#
|
@@ -45,18 +45,18 @@
|
|
45
45
|
# ######################################################################## #
|
46
46
|
|
47
47
|
|
48
|
-
=begin
|
49
|
-
=end
|
50
|
-
|
51
48
|
require 'libpath/diagnostics'
|
52
49
|
require 'libpath/form/unix'
|
53
50
|
require 'libpath/internal_/array'
|
54
51
|
require 'libpath/internal_/unix/form'
|
55
52
|
|
56
53
|
|
57
|
-
|
58
|
-
|
59
|
-
|
54
|
+
=begin
|
55
|
+
=end
|
56
|
+
|
57
|
+
module LibPath
|
58
|
+
module Util
|
59
|
+
module Unix
|
60
60
|
|
61
61
|
# Module defining instance functions that will be included and extended into
|
62
62
|
# any class or module including/extending module LibPath::Util::Unix
|
data/lib/libpath/util/windows.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# Purpose: LibPath::Util::Windows module
|
6
6
|
#
|
7
7
|
# Created: 10th January 2019
|
8
|
-
# Updated:
|
8
|
+
# Updated: 13th April 2024
|
9
9
|
#
|
10
10
|
# Home: http://github.com/synesissoftware/libpath.Ruby
|
11
11
|
#
|
@@ -45,18 +45,18 @@
|
|
45
45
|
# ######################################################################## #
|
46
46
|
|
47
47
|
|
48
|
-
=begin
|
49
|
-
=end
|
50
|
-
|
51
48
|
require 'libpath/diagnostics'
|
52
49
|
require 'libpath/form/windows'
|
53
50
|
require 'libpath/internal_/array'
|
54
51
|
require 'libpath/internal_/windows/form'
|
55
52
|
|
56
53
|
|
57
|
-
|
58
|
-
|
59
|
-
|
54
|
+
=begin
|
55
|
+
=end
|
56
|
+
|
57
|
+
module LibPath
|
58
|
+
module Util
|
59
|
+
module Windows
|
60
60
|
|
61
61
|
# Module defining instance functions that will be included and extended into
|
62
62
|
# any class or module including/extending module LibPath::Util::Windows
|
data/lib/libpath/util.rb
CHANGED
data/lib/libpath/version.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
# Purpose: Version for libpath.Ruby library
|
5
5
|
#
|
6
6
|
# Created: 8th January 2019
|
7
|
-
# Updated:
|
7
|
+
# Updated: 13th April 2024
|
8
8
|
#
|
9
9
|
# Home: http://github.com/synesissoftware/libpath.Ruby
|
10
10
|
#
|
@@ -47,25 +47,25 @@
|
|
47
47
|
=begin
|
48
48
|
=end
|
49
49
|
|
50
|
-
module LibPath
|
50
|
+
module LibPath
|
51
51
|
|
52
52
|
# Current version of the libpath.Ruby library
|
53
|
-
VERSION = '0.2.2.
|
53
|
+
VERSION = '0.2.2.3'
|
54
54
|
|
55
55
|
private
|
56
|
+
# @!visibility private
|
56
57
|
VERSION_PARTS_ = VERSION.split(/[.]/).collect { |n| n.to_i } # :nodoc:
|
57
58
|
public
|
58
59
|
# Major version of the libpath.Ruby library
|
59
|
-
VERSION_MAJOR = VERSION_PARTS_[0]
|
60
|
+
VERSION_MAJOR = VERSION_PARTS_[0]
|
60
61
|
# Minor version of the libpath.Ruby library
|
61
|
-
VERSION_MINOR = VERSION_PARTS_[1]
|
62
|
+
VERSION_MINOR = VERSION_PARTS_[1]
|
62
63
|
# Patch version of the libpath.Ruby library
|
63
|
-
VERSION_PATCH = VERSION_PARTS_[2]
|
64
|
+
VERSION_PATCH = VERSION_PARTS_[2]
|
64
65
|
# Revision version of the libpath.Ruby library
|
65
|
-
VERSION_REVISION = VERSION_PATCH
|
66
|
+
VERSION_REVISION = VERSION_PATCH
|
66
67
|
# Sub-patch version of the libpath.Ruby library
|
67
|
-
VERSION_SUBPATCH = VERSION_PARTS_[3]
|
68
|
-
|
68
|
+
VERSION_SUBPATCH = VERSION_PARTS_[3]
|
69
69
|
end # module LibPath
|
70
70
|
|
71
71
|
|
@@ -22,13 +22,6 @@ require 'benchmark'
|
|
22
22
|
|
23
23
|
ITERATIONS = 100000
|
24
24
|
|
25
|
-
SMALL_STRINGS = [
|
26
|
-
|
27
|
-
'C:\dir0\dir1/dir2',
|
28
|
-
'C:\dir0\dir1/dir2\dir3\dir4/',
|
29
|
-
'C:/dir0/dir1\dir2',
|
30
|
-
]
|
31
|
-
|
32
25
|
LONG_STRINGS = [
|
33
26
|
|
34
27
|
'C:' + '\dir' * 1000,
|
@@ -36,6 +29,13 @@ LONG_STRINGS = [
|
|
36
29
|
'C:' + '\dir/dir' * 500,
|
37
30
|
]
|
38
31
|
|
32
|
+
SMALL_STRINGS = [
|
33
|
+
|
34
|
+
'C:\dir0\dir1/dir2',
|
35
|
+
'C:\dir0\dir1/dir2\dir3\dir4/',
|
36
|
+
'C:/dir0/dir1\dir2',
|
37
|
+
]
|
38
|
+
|
39
39
|
|
40
40
|
def by_two_calls(s)
|
41
41
|
|
@@ -23,8 +23,8 @@ class Test_MalformedNameException < Test::Unit::TestCase
|
|
23
23
|
|
24
24
|
assert_not_nil mnx
|
25
25
|
assert_not_nil mnx.name
|
26
|
-
assert_match
|
27
|
-
assert_match
|
26
|
+
assert_match(/abc.*def/, mnx.name)
|
27
|
+
assert_match(/malformed name 'abc.*def'/, mnx.message)
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|