libpath-ruby 0.2.2 → 0.2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +33 -0
- data/README.md +25 -8
- data/examples/path_from_arg0.md +43 -43
- data/examples/path_from_arg0.rb +25 -23
- data/lib/libpath/constants/unix.rb +71 -71
- data/lib/libpath/constants/windows.rb +72 -72
- data/lib/libpath/constants.rb +18 -19
- data/lib/libpath/diagnostics/parameter_checking.rb +25 -25
- data/lib/libpath/diagnostics.rb +1 -1
- data/lib/libpath/exceptions/libpath_base_exception.rb +13 -13
- data/lib/libpath/exceptions/malformed_name_exception.rb +23 -22
- data/lib/libpath/exceptions.rb +1 -1
- data/lib/libpath/form/unix.rb +104 -103
- data/lib/libpath/form/windows.rb +200 -199
- data/lib/libpath/form.rb +18 -18
- data/lib/libpath/internal_/array.rb +53 -53
- data/lib/libpath/internal_/platform.rb +24 -24
- data/lib/libpath/internal_/string.rb +18 -18
- data/lib/libpath/internal_/unix/form.rb +116 -116
- data/lib/libpath/internal_/windows/drive.rb +59 -59
- data/lib/libpath/internal_/windows/form.rb +189 -189
- data/lib/libpath/libpath.rb +3 -0
- data/lib/libpath/path/unix.rb +114 -112
- data/lib/libpath/path/windows.rb +120 -118
- data/lib/libpath/path.rb +18 -20
- data/lib/libpath/util/unix.rb +258 -258
- data/lib/libpath/util/windows.rb +400 -400
- data/lib/libpath/util.rb +18 -19
- data/lib/libpath/version.rb +23 -24
- data/lib/libpath.rb +1 -1
- data/test/performance/benchmark_drive_letter.rb +50 -10
- data/test/performance/benchmark_gsub_string_or_regex.rb +27 -23
- data/test/performance/benchmark_rindex2.rb +56 -48
- data/test/performance/benchmark_split.rb +16 -10
- data/test/unit/compare/ts_all.rb +4 -4
- data/test/unit/equate/ts_all.rb +4 -4
- data/test/unit/equate/unix/ts_all.rb +4 -4
- data/test/unit/equate/windows/ts_all.rb +4 -4
- data/test/unit/exceptions/tc_libpath_base_exception.rb +10 -8
- data/test/unit/exceptions/tc_malformed_name_exception.rb +14 -12
- data/test/unit/exceptions/ts_all.rb +4 -4
- data/test/unit/form/tc_absolute_functions.rb +242 -240
- data/test/unit/form/ts_all.rb +4 -4
- data/test/unit/form/unix/tc_absolute_functions.rb +158 -155
- data/test/unit/form/unix/ts_all.rb +4 -4
- data/test/unit/form/windows/tc_absolute_functions.rb +628 -625
- data/test/unit/form/windows/ts_all.rb +4 -4
- data/test/unit/internal_/tc_array.rb +36 -32
- data/test/unit/internal_/ts_all.rb +4 -4
- data/test/unit/internal_/unix/form/tc_slash_functions.rb +38 -35
- data/test/unit/internal_/unix/form/ts_all.rb +4 -4
- data/test/unit/internal_/unix/tc_split_path.rb +387 -384
- data/test/unit/internal_/unix/ts_all.rb +4 -4
- data/test/unit/internal_/windows/form/tc_get_windows_volume.rb +157 -153
- data/test/unit/internal_/windows/form/tc_slash_functions.rb +39 -35
- data/test/unit/internal_/windows/form/ts_all.rb +4 -4
- data/test/unit/internal_/windows/tc_split_path.rb +874 -869
- data/test/unit/internal_/windows/ts_all.rb +4 -4
- data/test/unit/parse/ts_all.rb +4 -4
- data/test/unit/path/tc_path.rb +732 -732
- data/test/unit/path/ts_all.rb +4 -4
- data/test/unit/path/unix/tc_path.rb +544 -540
- data/test/unit/path/unix/ts_all.rb +4 -4
- data/test/unit/path/windows/tc_path.rb +608 -603
- data/test/unit/path/windows/ts_all.rb +4 -4
- data/test/unit/tc_version.rb +25 -22
- data/test/unit/ts_all.rb +4 -4
- data/test/unit/util/tc_combine_paths.rb +110 -105
- data/test/unit/util/tc_derive_relative_path.rb +8 -3
- data/test/unit/util/tc_make_path_canonical.rb +142 -138
- data/test/unit/util/ts_all.rb +4 -4
- data/test/unit/util/unix/tc_combine_paths.rb +38 -34
- data/test/unit/util/unix/tc_derive_relative_path.rb +80 -75
- data/test/unit/util/unix/tc_make_path_absolute.rb +74 -70
- data/test/unit/util/unix/tc_make_path_canonical.rb +95 -90
- data/test/unit/util/unix/ts_all.rb +4 -4
- data/test/unit/util/windows/tc_combine_paths.rb +82 -77
- data/test/unit/util/windows/tc_derive_relative_path.rb +98 -93
- data/test/unit/util/windows/tc_make_path_absolute.rb +105 -101
- data/test/unit/util/windows/tc_make_path_canonical.rb +158 -153
- data/test/unit/util/windows/ts_all.rb +4 -4
- metadata +9 -8
data/lib/libpath/path/unix.rb
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
|
2
2
|
# ######################################################################## #
|
3
|
-
# File:
|
3
|
+
# File: libpath/path/unix.rb
|
4
4
|
#
|
5
|
-
# Purpose:
|
5
|
+
# Purpose: LibPath::Path::Unix module
|
6
6
|
#
|
7
|
-
# Created:
|
8
|
-
# Updated:
|
7
|
+
# Created: 21st January 2019
|
8
|
+
# Updated: 6th April 2024
|
9
9
|
#
|
10
|
-
# Home:
|
10
|
+
# Home: http://github.com/synesissoftware/libpath.Ruby
|
11
11
|
#
|
12
|
-
# Author:
|
12
|
+
# Author: Matthew Wilson
|
13
13
|
#
|
14
|
+
# Copyright (c) 2019-2024, Matthew Wilson and Synesis Information Systems
|
14
15
|
# Copyright (c) 2019, Matthew Wilson and Synesis Software
|
15
16
|
# All rights reserved.
|
16
17
|
#
|
@@ -44,7 +45,6 @@
|
|
44
45
|
# ######################################################################## #
|
45
46
|
|
46
47
|
|
47
|
-
|
48
48
|
=begin
|
49
49
|
=end
|
50
50
|
|
@@ -52,119 +52,121 @@ require 'libpath/diagnostics'
|
|
52
52
|
require 'libpath/internal_/unix/form'
|
53
53
|
require 'libpath/util/unix'
|
54
54
|
|
55
|
+
|
55
56
|
module LibPath # :nodoc:
|
56
57
|
module Path # :nodoc:
|
57
58
|
module Unix # :nodoc:
|
58
59
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
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
|
-
|
163
|
-
|
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)
|
101
|
+
|
102
|
+
@given_path = path
|
103
|
+
@absolute_path = abs_path
|
104
|
+
@compare_path = _Util.make_compare_path abs_path
|
105
|
+
@directory = f2_dir
|
106
|
+
@directory_path = f2_dir
|
107
|
+
@directory_parts = f6_dir_parts
|
108
|
+
|
109
|
+
@file_full_name = f3_basename
|
110
|
+
@file_name_only = f4_stem
|
111
|
+
@file_extension = f5_ext
|
112
|
+
|
113
|
+
if search_directory
|
114
|
+
|
115
|
+
drp_options = options.select { |k| _C::INIT_DRP_COMMON_OPTIONS.include?(k) }
|
116
|
+
|
117
|
+
search_directory = _Util.make_path_absolute(search_directory, make_canonical: true, **options.select { |k| _C::INIT_MPA_COMMON_OPTIONS.include?(k) })
|
118
|
+
search_directory = _Internal_Form.append_trailing_slash search_directory
|
119
|
+
|
120
|
+
@search_directory = search_directory
|
121
|
+
@search_relative_path = _Util.derive_relative_path(search_directory, abs_path, **drp_options)
|
122
|
+
@search_relative_path = _Internal_Form.append_trailing_slash(@search_relative_path) if _Internal_Form.char_is_path_name_separator?(abs_path[-1])
|
123
|
+
@search_relative_directory_path = _Internal_Form.append_trailing_slash _Util.derive_relative_path(search_directory, f2_dir, **drp_options)
|
124
|
+
@search_relative_directory_parts = @search_relative_directory_path.split('/').map { |v| v + '/' }
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
# (String) The path given to initialise the instance
|
129
|
+
attr_reader :given_path
|
130
|
+
# (String) The full-path of the instance
|
131
|
+
attr_reader :absolute_path
|
132
|
+
# (String) A normalised form of #path that can be used in comparisons
|
133
|
+
attr_reader :compare_path
|
134
|
+
# (String) The entry's directory (excluding the #drive if on Windows)
|
135
|
+
attr_reader :directory
|
136
|
+
# (String) The full path of the entry's directory
|
137
|
+
attr_reader :directory_path
|
138
|
+
alias_method :dirname, :directory_path
|
139
|
+
# ([String]) An array of directory parts, where each part ends in the path name separator
|
140
|
+
attr_reader :directory_parts
|
141
|
+
# (String) The entry's file name (combination of #stem + #extension)
|
142
|
+
attr_reader :file_full_name
|
143
|
+
alias_method :basename, :file_full_name
|
144
|
+
# (String) The entry's file stem
|
145
|
+
attr_reader :file_name_only
|
146
|
+
alias_method :stem, :file_name_only
|
147
|
+
# (String) The entry's file extension
|
148
|
+
attr_reader :file_extension
|
149
|
+
alias_method :extension, :file_extension
|
150
|
+
# (String) The search directory if specified; +nil+ otherwise
|
151
|
+
attr_reader :search_directory
|
152
|
+
# (String) The #path relative to #search_directory; +nil+ if no search directory specified
|
153
|
+
attr_reader :search_relative_path
|
154
|
+
# (String) The #directory_path relative to #search_directory; +nil+ if no search directory specified
|
155
|
+
attr_reader :search_relative_directory_path
|
156
|
+
# ([String]) The #directory_parts relative to #search_directory; +nil+ if no search directory specified
|
157
|
+
attr_reader :search_relative_directory_parts
|
158
|
+
|
159
|
+
# (String) String form of path
|
160
|
+
def to_s
|
161
|
+
|
162
|
+
absolute_path
|
163
|
+
end
|
164
|
+
end
|
164
165
|
|
165
166
|
end # module Unix
|
166
167
|
end # module Path
|
167
168
|
end # module LibPath
|
168
169
|
|
170
|
+
|
169
171
|
# ############################## end of file ############################# #
|
170
172
|
|
data/lib/libpath/path/windows.rb
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
|
2
2
|
# ######################################################################## #
|
3
|
-
# File:
|
3
|
+
# File: libpath/path/windows.rb
|
4
4
|
#
|
5
|
-
# Purpose:
|
5
|
+
# Purpose: LibPath::Path::Windows module
|
6
6
|
#
|
7
|
-
# Created:
|
8
|
-
# Updated:
|
7
|
+
# Created: 21st January 2019
|
8
|
+
# Updated: 6th April 2024
|
9
9
|
#
|
10
|
-
# Home:
|
10
|
+
# Home: http://github.com/synesissoftware/libpath.Ruby
|
11
11
|
#
|
12
|
-
# Author:
|
12
|
+
# Author: Matthew Wilson
|
13
13
|
#
|
14
|
+
# Copyright (c) 2019-2024, Matthew Wilson and Synesis Information Systems
|
14
15
|
# Copyright (c) 2019, Matthew Wilson and Synesis Software
|
15
16
|
# All rights reserved.
|
16
17
|
#
|
@@ -44,7 +45,6 @@
|
|
44
45
|
# ######################################################################## #
|
45
46
|
|
46
47
|
|
47
|
-
|
48
48
|
=begin
|
49
49
|
=end
|
50
50
|
|
@@ -52,125 +52,127 @@ require 'libpath/diagnostics'
|
|
52
52
|
require 'libpath/internal_/windows/form'
|
53
53
|
require 'libpath/util/windows'
|
54
54
|
|
55
|
+
|
55
56
|
module LibPath # :nodoc:
|
56
57
|
module Path # :nodoc:
|
57
58
|
module Windows # :nodoc:
|
58
59
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
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
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
60
|
+
# Class representing a parsed path (for Windows)
|
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_::Windows::Form
|
92
|
+
_Util = ::LibPath::Util::Windows
|
93
|
+
_C = ::LibPath::Path::Windows::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
|
+
splits = _Internal_Form.split_path(abs_path)
|
101
|
+
|
102
|
+
_, f1_vol, f2_dir, f3_basename, f4_stem, f5_ext, f6_dir_parts, f7_abs_parts = *splits
|
103
|
+
|
104
|
+
@given_path = path
|
105
|
+
@absolute_path = abs_path
|
106
|
+
@compare_path = _Util.make_compare_path abs_path, splits: splits
|
107
|
+
@volume = f1_vol
|
108
|
+
@directory = f2_dir
|
109
|
+
@directory_path = "#{f1_vol}#{f2_dir}"
|
110
|
+
@directory_parts = f6_dir_parts
|
111
|
+
|
112
|
+
@file_full_name = f3_basename
|
113
|
+
@file_name_only = f4_stem
|
114
|
+
@file_extension = f5_ext
|
115
|
+
|
116
|
+
if search_directory
|
117
|
+
|
118
|
+
drp_options = options.select { |k| _C::INIT_DRP_COMMON_OPTIONS.include?(k) }
|
119
|
+
|
120
|
+
search_directory = _Util.make_path_canonical search_directory, make_slashes_canonical: true
|
121
|
+
search_directory = _Internal_Form.append_trailing_slash search_directory
|
122
|
+
|
123
|
+
@search_directory = search_directory
|
124
|
+
@search_relative_path = _Util.derive_relative_path(search_directory, abs_path, **drp_options)
|
125
|
+
@search_relative_path = _Internal_Form.append_trailing_slash(@search_relative_path) if _Internal_Form.char_is_path_name_separator?(abs_path[-1])
|
126
|
+
@search_relative_directory_path = _Internal_Form.append_trailing_slash _Util.derive_relative_path(search_directory, "#{f1_vol}#{f2_dir}", **drp_options)
|
127
|
+
@search_relative_directory_parts = @search_relative_directory_path.split('\\').map { |v| v + '\\' }
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
# (String) The path given to initialise the instance
|
132
|
+
attr_reader :given_path
|
133
|
+
# (String) The full-path of the instance
|
134
|
+
attr_reader :absolute_path
|
135
|
+
# (String) A normalised form of #path that can be used in comparisons
|
136
|
+
attr_reader :compare_path
|
137
|
+
# (String) The Windows volume, which may be a drive, or a UNC specification
|
138
|
+
attr_reader :volume
|
139
|
+
# (String) The entry's directory (excluding the #drive if on Windows)
|
140
|
+
attr_reader :directory
|
141
|
+
# (String) The full path of the entry's directory (taking into account the
|
142
|
+
# #drive if on Windows)
|
143
|
+
attr_reader :directory_path
|
144
|
+
alias_method :dirname, :directory_path
|
145
|
+
# ([String]) An array of directory parts, where each part ends in the path name separator
|
146
|
+
attr_reader :directory_parts
|
147
|
+
# (String) The entry's file name (combination of #stem + #extension)
|
148
|
+
attr_reader :file_full_name
|
149
|
+
alias_method :basename, :file_full_name
|
150
|
+
# (String) The entry's file stem
|
151
|
+
attr_reader :file_name_only
|
152
|
+
alias_method :stem, :file_name_only
|
153
|
+
# (String) The entry's file extension
|
154
|
+
attr_reader :file_extension
|
155
|
+
alias_method :extension, :file_extension
|
156
|
+
# (String) The search directory if specified; +nil+ otherwise
|
157
|
+
attr_reader :search_directory
|
158
|
+
# (String) The #path relative to #search_directory; +nil+ if no search directory specified
|
159
|
+
attr_reader :search_relative_path
|
160
|
+
# (String) The #directory_path relative to #search_directory; +nil+ if no search directory specified
|
161
|
+
attr_reader :search_relative_directory_path
|
162
|
+
# ([String]) The #directory_parts relative to #search_directory; +nil+ if no search directory specified
|
163
|
+
attr_reader :search_relative_directory_parts
|
164
|
+
|
165
|
+
# (String) String form of path
|
166
|
+
def to_s
|
167
|
+
|
168
|
+
absolute_path
|
169
|
+
end
|
170
|
+
end
|
170
171
|
|
171
172
|
end # module Windows
|
172
173
|
end # module Path
|
173
174
|
end # module LibPath
|
174
175
|
|
176
|
+
|
175
177
|
# ############################## end of file ############################# #
|
176
178
|
|
data/lib/libpath/path.rb
CHANGED
@@ -3,41 +3,39 @@ require 'libpath/internal_/platform'
|
|
3
3
|
|
4
4
|
if ::LibPath::Internal_::Platform::Constants::PLATFORM_IS_WINDOWS then
|
5
5
|
|
6
|
-
|
6
|
+
require 'libpath/path/windows'
|
7
7
|
else
|
8
8
|
|
9
|
-
|
9
|
+
require 'libpath/path/unix'
|
10
10
|
end
|
11
11
|
|
12
12
|
module LibPath # :nodoc:
|
13
13
|
module Path # :nodoc:
|
14
14
|
|
15
|
-
|
15
|
+
if ::LibPath::Internal_::Platform::Constants::PLATFORM_IS_WINDOWS then
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
extend ::LibPath::Path::Windows
|
18
|
+
include ::LibPath::Path::Windows
|
19
|
+
else
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
extend ::LibPath::Path::Unix
|
22
|
+
include ::LibPath::Path::Unix
|
23
|
+
end
|
24
24
|
|
25
|
-
|
26
|
-
|
25
|
+
# @!visibility private
|
26
|
+
def self.extended receiver # :nodoc:
|
27
27
|
|
28
|
-
|
29
|
-
|
28
|
+
$stderr.puts "#{receiver} extended by #{self}" if $DEBUG
|
29
|
+
end
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
$stderr.puts "#{receiver} included #{self}" if $DEBUG
|
35
|
-
end
|
31
|
+
# @!visibility private
|
32
|
+
def self.included receiver # :nodoc:
|
36
33
|
|
34
|
+
$stderr.puts "#{receiver} included #{self}" if $DEBUG
|
35
|
+
end
|
37
36
|
end # module Path
|
38
37
|
end # module LibPath
|
39
38
|
|
40
|
-
# ############################## end of file ############################# #
|
41
|
-
|
42
39
|
|
40
|
+
# ############################## end of file ############################# #
|
43
41
|
|