libpath-ruby 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +61 -0
  3. data/examples/path_from_arg0.md +99 -0
  4. data/examples/path_from_arg0.rb +55 -0
  5. data/lib/libpath.rb +12 -0
  6. data/lib/libpath/constants.rb +42 -0
  7. data/lib/libpath/constants/unix.rb +146 -0
  8. data/lib/libpath/constants/windows.rb +147 -0
  9. data/lib/libpath/diagnostics.rb +6 -0
  10. data/lib/libpath/diagnostics/parameter_checking.rb +46 -0
  11. data/lib/libpath/exceptions.rb +7 -0
  12. data/lib/libpath/exceptions/libpath_base_exception.rb +77 -0
  13. data/lib/libpath/exceptions/malformed_name_exception.rb +85 -0
  14. data/lib/libpath/form.rb +42 -0
  15. data/lib/libpath/form/unix.rb +215 -0
  16. data/lib/libpath/form/windows.rb +358 -0
  17. data/lib/libpath/internal_/array.rb +96 -0
  18. data/lib/libpath/internal_/platform.rb +53 -0
  19. data/lib/libpath/internal_/string.rb +33 -0
  20. data/lib/libpath/internal_/unix/form.rb +160 -0
  21. data/lib/libpath/internal_/windows/drive.rb +84 -0
  22. data/lib/libpath/internal_/windows/form.rb +281 -0
  23. data/lib/libpath/libpath.rb +6 -0
  24. data/lib/libpath/path.rb +43 -0
  25. data/lib/libpath/path/unix.rb +170 -0
  26. data/lib/libpath/path/windows.rb +176 -0
  27. data/lib/libpath/util.rb +42 -0
  28. data/lib/libpath/util/unix.rb +414 -0
  29. data/lib/libpath/util/windows.rb +636 -0
  30. data/lib/libpath/version.rb +73 -0
  31. data/test/performance/benchmark_drive_letter.rb +31 -0
  32. data/test/performance/benchmark_gsub_string_or_regex.rb +45 -0
  33. data/test/performance/benchmark_rindex2.rb +109 -0
  34. data/test/performance/benchmark_split.rb +32 -0
  35. data/test/unit/compare/ts_all.rb +22 -0
  36. data/test/unit/equate/ts_all.rb +22 -0
  37. data/test/unit/equate/unix/ts_all.rb +22 -0
  38. data/test/unit/equate/windows/ts_all.rb +22 -0
  39. data/test/unit/exceptions/tc_libpath_base_exception.rb +27 -0
  40. data/test/unit/exceptions/tc_malformed_name_exception.rb +31 -0
  41. data/test/unit/exceptions/ts_all.rb +22 -0
  42. data/test/unit/form/tc_absolute_functions.rb +369 -0
  43. data/test/unit/form/ts_all.rb +22 -0
  44. data/test/unit/form/unix/tc_absolute_functions.rb +269 -0
  45. data/test/unit/form/unix/ts_all.rb +22 -0
  46. data/test/unit/form/windows/tc_absolute_functions.rb +854 -0
  47. data/test/unit/form/windows/ts_all.rb +22 -0
  48. data/test/unit/internal_/tc_array.rb +62 -0
  49. data/test/unit/internal_/ts_all.rb +22 -0
  50. data/test/unit/internal_/unix/form/tc_slash_functions.rb +60 -0
  51. data/test/unit/internal_/unix/form/ts_all.rb +22 -0
  52. data/test/unit/internal_/unix/tc_split_path.rb +396 -0
  53. data/test/unit/internal_/unix/ts_all.rb +22 -0
  54. data/test/unit/internal_/windows/form/tc_get_windows_volume.rb +220 -0
  55. data/test/unit/internal_/windows/form/tc_slash_functions.rb +61 -0
  56. data/test/unit/internal_/windows/form/ts_all.rb +22 -0
  57. data/test/unit/internal_/windows/tc_split_path.rb +881 -0
  58. data/test/unit/internal_/windows/ts_all.rb +22 -0
  59. data/test/unit/parse/ts_all.rb +22 -0
  60. data/test/unit/path/tc_path.rb +778 -0
  61. data/test/unit/path/ts_all.rb +22 -0
  62. data/test/unit/path/unix/tc_path.rb +565 -0
  63. data/test/unit/path/unix/ts_all.rb +22 -0
  64. data/test/unit/path/windows/tc_path.rb +630 -0
  65. data/test/unit/path/windows/ts_all.rb +22 -0
  66. data/test/unit/tc_version.rb +47 -0
  67. data/test/unit/ts_all.rb +22 -0
  68. data/test/unit/util/tc_combine_paths.rb +179 -0
  69. data/test/unit/util/tc_derive_relative_path.rb +19 -0
  70. data/test/unit/util/tc_make_path_canonical.rb +228 -0
  71. data/test/unit/util/ts_all.rb +22 -0
  72. data/test/unit/util/unix/tc_combine_paths.rb +65 -0
  73. data/test/unit/util/unix/tc_derive_relative_path.rb +123 -0
  74. data/test/unit/util/unix/tc_make_path_absolute.rb +117 -0
  75. data/test/unit/util/unix/tc_make_path_canonical.rb +139 -0
  76. data/test/unit/util/unix/ts_all.rb +22 -0
  77. data/test/unit/util/windows/tc_combine_paths.rb +131 -0
  78. data/test/unit/util/windows/tc_derive_relative_path.rb +155 -0
  79. data/test/unit/util/windows/tc_make_path_absolute.rb +163 -0
  80. data/test/unit/util/windows/tc_make_path_canonical.rb +220 -0
  81. data/test/unit/util/windows/ts_all.rb +22 -0
  82. metadata +144 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6dd88bc30d1032ce6d4a4b279bb0692fbc0669205be981d9182abd7b6adbf7b9
4
+ data.tar.gz: 778b9b33864a813d2ab4ff67b8685f6ee193c0eeeb9b4632647a655ca4ff6ab5
5
+ SHA512:
6
+ metadata.gz: 02f1f20771f342c7df0945a887a3611fe1357e06e7a22c182382901711c837aef4fe6ec12e7c3ade63d9e86ee52697b30957eec7544271d998192ba3d633b9a3
7
+ data.tar.gz: 3a1bcce47edcfdee2f20a05fa7d42b4929d5a7abce60fec405e8d89e5141597825cf4cfd4dee0c74f057540f4e167bc44ce556891345aacb7a4ee690fbd8d33f
data/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # libpath.Ruby
2
+ **libpath**, for Ruby
3
+
4
+ [![Gem Version](https://badge.fury.io/rb/libpath-ruby.svg)](https://badge.fury.io/rb/libpath-ruby)
5
+
6
+ ## Table of Contents
7
+
8
+ 1. [Introduction](#introduction)
9
+ 2. [Installation](#installation)
10
+ 3. [Components](#components)
11
+ 4. [Examples](#examples)
12
+ 5. [Project Information](#project-information)
13
+
14
+ ## Introduction
15
+
16
+ **libpath** is a path-parsing and utility library. It is concerned entirely with paths, as opposed to file-system entities.
17
+
18
+ ## Installation
19
+
20
+ Install via **gem** as in:
21
+
22
+ ```
23
+ gem install libpath-ruby
24
+ ```
25
+
26
+ or add it to your `Gemfile`.
27
+
28
+ Use via **require**, as in:
29
+
30
+ ```Ruby
31
+ require 'libpath'
32
+ ```
33
+
34
+ ## Components
35
+
36
+ T.B.C.
37
+
38
+ ## Examples
39
+
40
+ Examples are provided in the ```examples``` directory, along with a markdown description for each. A detailed list TOC of them is provided in [EXAMPLES.md](./EXAMPLES.md).
41
+
42
+ ## Project Information
43
+
44
+ ### Where to get help
45
+
46
+ [GitHub Page](https://github.com/synesissoftware/libpath.Ruby "GitHub Page")
47
+
48
+ ### Contribution guidelines
49
+
50
+ Defect reports, feature requests, and pull requests are welcome on https://github.com/synesissoftware/libpath.Ruby.
51
+
52
+ ### Related projects
53
+
54
+ **libpath.Ruby** is based on the [C/C++ libpath library](https://github.com/synesissoftware/libpath), which itself was prompted by a request on the [STLSoft](https://github.com/synesissoftware/STLSoft-1.10) project by my friend and esteemed programmer [Adi Shavit](https://github.com/adishavit).
55
+
56
+ **libpath.Ruby** will be used in **version 3+** of the **[recls.Ruby](https://github.com/synesissoftware/recls.Ruby)** library, which currently has its own path-parsing logic.
57
+
58
+ ### License
59
+
60
+ **libpath.Ruby** is released under the 3-clause BSD license. See LICENSE for details.
61
+
@@ -0,0 +1,99 @@
1
+ # libpath.Ruby Example - **path_from_arg0**
2
+
3
+ ## Summary
4
+
5
+ Simple example illustrating creation of an instance of ``LibPath::Path::ParsedPath``, and obtaining from it its attributes
6
+
7
+ ## Source
8
+
9
+ ```ruby
10
+ #! /usr/bin/env ruby
11
+
12
+ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
13
+
14
+ require 'libpath/path'
15
+
16
+
17
+ PATH_ATTRIBUTES = %i{
18
+
19
+ given_path
20
+ absolute_path
21
+ compare_path
22
+ directory
23
+ directory_path
24
+ dirname
25
+ directory_parts
26
+ file_full_name
27
+ basename
28
+ file_name_only
29
+ stem
30
+ file_extension
31
+ extension
32
+ search_directory
33
+ search_relative_path
34
+ search_relative_directory_path
35
+ search_relative_directory_parts
36
+ }
37
+
38
+
39
+ arg0 = ARGV[0] or abort "USAGE: <name> [<search-dir>]"
40
+ arg1 = ARGV[1]
41
+
42
+ path = LibPath::Path::ParsedPath.new arg0, arg1
43
+
44
+ puts "path obtained from '#{arg0}'" + (arg1 ? " (with search directory '#{arg1}')" : '') + ':'
45
+ puts
46
+
47
+ puts "\tpath: #{path}"
48
+ puts
49
+
50
+ puts "\tall attributes:"
51
+
52
+ max_name_len = PATH_ATTRIBUTES.map { |sym| sym.to_s.size }.max_by { |s| s }
53
+ max_type_len = PATH_ATTRIBUTES.map { |sym| path.send(sym).class.to_s.size }.max_by { |s| s }
54
+
55
+ PATH_ATTRIBUTES.each do |attr|
56
+
57
+ name = attr.to_s
58
+ value = path.send(attr)
59
+ type = value.class
60
+
61
+ puts "\t\t#{name.to_s.rjust(max_name_len)} (#{type.to_s.rjust(max_type_len)}) : #{value}"
62
+ end
63
+ ```
64
+
65
+ ## Usage
66
+
67
+ When executed with the following command-line (on my machine):
68
+
69
+ ```
70
+ ./examples/path_from_arg0.rb .gitignore ../../../CLASP/CLASP.Ruby/trunk
71
+ ```
72
+
73
+ The output is:
74
+
75
+ ```
76
+ path obtained from '.gitignore' (with search directory '../../../CLASP/CLASP.Ruby/trunk'):
77
+
78
+ path: /Users/matthewwilson/dev/freelibs/libpath/libpath.Ruby/trunk/.gitignore
79
+
80
+ all attributes:
81
+ given_path ( String) : .gitignore
82
+ absolute_path ( String) : /Users/matthewwilson/dev/freelibs/libpath/libpath.Ruby/trunk/.gitignore
83
+ compare_path ( String) : /Users/matthewwilson/dev/freelibs/libpath/libpath.Ruby/trunk/.gitignore
84
+ directory ( String) : /Users/matthewwilson/dev/freelibs/libpath/libpath.Ruby/trunk/
85
+ directory_path ( String) : /Users/matthewwilson/dev/freelibs/libpath/libpath.Ruby/trunk/
86
+ dirname ( String) : /Users/matthewwilson/dev/freelibs/libpath/libpath.Ruby/trunk/
87
+ directory_parts ( Array) : ["/", "Users/", "matthewwilson/", "dev/", "freelibs/", "libpath/", "libpath.Ruby/", "trunk/"]
88
+ file_full_name ( String) : .gitignore
89
+ basename ( String) : .gitignore
90
+ file_name_only (NilClass) :
91
+ stem (NilClass) :
92
+ file_extension ( String) : .gitignore
93
+ extension ( String) : .gitignore
94
+ search_directory ( String) : /Users/matthewwilson/dev/freelibs/CLASP/CLASP.Ruby/trunk/
95
+ search_relative_path ( String) : ../../../libpath/libpath.Ruby/trunk/.gitignore
96
+ search_relative_directory_path ( String) : ../../../libpath/libpath.Ruby/trunk/
97
+ search_relative_directory_parts ( Array) : ["../", "../", "../", "libpath/", "libpath.Ruby/", "trunk/"]
98
+ ```
99
+
@@ -0,0 +1,55 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
4
+
5
+ require 'libpath/path'
6
+
7
+
8
+ PATH_ATTRIBUTES = %i{
9
+
10
+ given_path
11
+ absolute_path
12
+ compare_path
13
+ directory
14
+ directory_path
15
+ dirname
16
+ directory_parts
17
+ file_full_name
18
+ basename
19
+ file_name_only
20
+ stem
21
+ file_extension
22
+ extension
23
+ search_directory
24
+ search_relative_path
25
+ search_relative_directory_path
26
+ search_relative_directory_parts
27
+ }
28
+
29
+
30
+ arg0 = ARGV[0] or abort "USAGE: <name> [<search-dir>]"
31
+ arg1 = ARGV[1]
32
+
33
+ path = LibPath::Path::ParsedPath.new arg0, arg1
34
+
35
+ puts "path obtained from '#{arg0}'" + (arg1 ? " (with search directory '#{arg1}')" : '') + ':'
36
+ puts
37
+
38
+ puts "\tpath: #{path}"
39
+ puts
40
+
41
+ puts "\tall attributes:"
42
+
43
+ max_name_len = PATH_ATTRIBUTES.map { |sym| sym.to_s.size }.max_by { |s| s }
44
+ max_type_len = PATH_ATTRIBUTES.map { |sym| path.send(sym).class.to_s.size }.max_by { |s| s }
45
+
46
+ PATH_ATTRIBUTES.each do |attr|
47
+
48
+ name = attr.to_s
49
+ value = path.send(attr)
50
+ type = value.class
51
+
52
+ puts "\t\t#{name.to_s.rjust(max_name_len)} (#{type.to_s.rjust(max_type_len)}) : #{value}"
53
+ end
54
+
55
+
data/lib/libpath.rb ADDED
@@ -0,0 +1,12 @@
1
+
2
+ require 'libpath/libpath'
3
+
4
+ require 'libpath/form'
5
+ require 'libpath/path'
6
+ require 'libpath/util'
7
+
8
+ require 'libpath/version'
9
+
10
+ # ############################## end of file ############################# #
11
+
12
+
@@ -0,0 +1,42 @@
1
+
2
+ require 'libpath/internal_/platform'
3
+
4
+ if ::LibPath::Internal_::Platform::Constants::PLATFORM_IS_WINDOWS then
5
+
6
+ require 'libpath/constants/windows'
7
+ else
8
+
9
+ require 'libpath/constants/unix'
10
+ end
11
+
12
+ module LibPath # :nodoc:
13
+ module Constants # :nodoc:
14
+
15
+ if ::LibPath::Internal_::Platform::Constants::PLATFORM_IS_WINDOWS then
16
+
17
+ extend ::LibPath::Constants::Windows
18
+ include ::LibPath::Constants::Windows
19
+ else
20
+
21
+ extend ::LibPath::Constants::Unix
22
+ include ::LibPath::Constants::Unix
23
+ end
24
+
25
+ # @!visibility private
26
+ def self.extended receiver # :nodoc:
27
+
28
+ $stderr.puts "#{receiver} extended by #{self}" if $DEBUG
29
+ end
30
+
31
+ # @!visibility private
32
+ def self.included receiver # :nodoc:
33
+
34
+ $stderr.puts "#{receiver} included #{self}" if $DEBUG
35
+ end
36
+
37
+ end # module Constants
38
+ end # module LibPath
39
+
40
+ # ############################## end of file ############################# #
41
+
42
+
@@ -0,0 +1,146 @@
1
+ # ######################################################################## #
2
+ # File: libpath/constants/unix.rb
3
+ #
4
+ # Purpose: LibPath::Constants::Unix module
5
+ #
6
+ # Created: 29th January 2019
7
+ # Updated: 16th April 2019
8
+ #
9
+ # Home: http://github.com/synesissoftware/libpath.Ruby
10
+ #
11
+ # Author: Matthew Wilson
12
+ #
13
+ # Copyright (c) 2019, Matthew Wilson and Synesis Software
14
+ # All rights reserved.
15
+ #
16
+ # Redistribution and use in source and binary forms, with or without
17
+ # modification, are permitted provided that the following conditions are
18
+ # met:
19
+ #
20
+ # * Redistributions of source code must retain the above copyright
21
+ # notice, this list of conditions and the following disclaimer.
22
+ #
23
+ # * Redistributions in binary form must reproduce the above copyright
24
+ # notice, this list of conditions and the following disclaimer in the
25
+ # documentation and/or other materials provided with the distribution.
26
+ #
27
+ # * Neither the names of the copyright holder nor the names of its
28
+ # contributors may be used to endorse or promote products derived from
29
+ # this software without specific prior written permission.
30
+ #
31
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
32
+ # IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
33
+ # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
34
+ # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
35
+ # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
36
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
37
+ # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
38
+ # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
39
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
40
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
41
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42
+ #
43
+ # ######################################################################## #
44
+
45
+
46
+
47
+ =begin
48
+ =end
49
+
50
+ module LibPath # :nodoc:
51
+ module Constants # :nodoc:
52
+ module Unix # :nodoc:
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
57
+
58
+ # Defines invalid characters
59
+ module InvalidCharacters
60
+
61
+ # Innately invalid characters
62
+ module Innate
63
+
64
+ # The list of characters
65
+ LIST = [
66
+
67
+ "\0",
68
+ ]
69
+ # The regular expression
70
+ RE = /[#{LIST.map { |m| Regexp.escape m }.join}]/
71
+ end # module Innate
72
+
73
+ # Valid path name separator characters
74
+ module PathNameSeparators
75
+
76
+ # The list of characters
77
+ LIST = [
78
+
79
+ '/',
80
+ ]
81
+ # The regular expression
82
+ RE = /[#{LIST.map { |m| Regexp.escape m }.join}]/
83
+ end # module PathNameSeparators
84
+
85
+ # Valid path separator characters
86
+ module PathSeparators
87
+
88
+ # The list of characters
89
+ LIST = [
90
+
91
+ ':',
92
+ ]
93
+ # The regular expression
94
+ RE = /[#{LIST.map { |m| Regexp.escape m }.join}]/
95
+ end # module PathSeparators
96
+
97
+ # Invalid shell characters
98
+ module Shell
99
+
100
+ # The list of characters
101
+ LIST = [
102
+
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
+
115
+ # @!visibility private
116
+ def self.extended receiver # :nodoc:
117
+
118
+ receiver.class_eval do
119
+
120
+ extend LibPath_Constants_Unix_Methods
121
+ end
122
+
123
+ $stderr.puts "#{receiver} extended by #{LibPath_Constants_Unix_Methods}" if $DEBUG
124
+ end
125
+
126
+ # @!visibility private
127
+ def self.included receiver # :nodoc:
128
+
129
+ receiver.class_eval do
130
+
131
+ include LibPath_Constants_Unix_Methods
132
+ end
133
+
134
+ $stderr.puts "#{receiver} included #{LibPath_Constants_Unix_Methods}" if $DEBUG
135
+ end
136
+
137
+ extend LibPath_Constants_Unix_Methods
138
+ include LibPath_Constants_Unix_Methods
139
+
140
+ end # module Unix
141
+ end # module Constants
142
+ end # module LibPath
143
+
144
+ # ############################## end of file ############################# #
145
+
146
+
@@ -0,0 +1,147 @@
1
+ # ######################################################################## #
2
+ # File: libpath/constants/windows.rb
3
+ #
4
+ # Purpose: LibPath::Constants::Windows module
5
+ #
6
+ # Created: 29th January 2019
7
+ # Updated: 16th April 2019
8
+ #
9
+ # Home: http://github.com/synesissoftware/libpath.Ruby
10
+ #
11
+ # Author: Matthew Wilson
12
+ #
13
+ # Copyright (c) 2019, Matthew Wilson and Synesis Software
14
+ # All rights reserved.
15
+ #
16
+ # Redistribution and use in source and binary forms, with or without
17
+ # modification, are permitted provided that the following conditions are
18
+ # met:
19
+ #
20
+ # * Redistributions of source code must retain the above copyright
21
+ # notice, this list of conditions and the following disclaimer.
22
+ #
23
+ # * Redistributions in binary form must reproduce the above copyright
24
+ # notice, this list of conditions and the following disclaimer in the
25
+ # documentation and/or other materials provided with the distribution.
26
+ #
27
+ # * Neither the names of the copyright holder nor the names of its
28
+ # contributors may be used to endorse or promote products derived from
29
+ # this software without specific prior written permission.
30
+ #
31
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
32
+ # IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
33
+ # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
34
+ # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
35
+ # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
36
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
37
+ # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
38
+ # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
39
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
40
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
41
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42
+ #
43
+ # ######################################################################## #
44
+
45
+
46
+
47
+ =begin
48
+ =end
49
+
50
+ module LibPath # :nodoc:
51
+ module Constants # :nodoc:
52
+ module Windows # :nodoc:
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
57
+
58
+ # Defines invalid characters
59
+ module InvalidCharacters
60
+
61
+ # Innately invalid characters
62
+ module Innate
63
+
64
+ # The list of characters
65
+ LIST = [
66
+
67
+ "\0",
68
+ ]
69
+ # The regular expression
70
+ RE = /[#{LIST.map { |m| Regexp.escape m }.join}]/
71
+ end # module Innate
72
+
73
+ # Valid path name separator characters
74
+ module PathNameSeparators
75
+
76
+ # The list of characters
77
+ LIST = [
78
+
79
+ "\\",
80
+ '/',
81
+ ]
82
+ # The regular expression
83
+ RE = /[#{LIST.map { |m| Regexp.escape m }.join}]/
84
+ end # module PathNameSeparators
85
+
86
+ # Valid path separator characters
87
+ module PathSeparators
88
+
89
+ # The list of characters
90
+ LIST = [
91
+
92
+ ';',
93
+ ]
94
+ # The regular expression
95
+ RE = /[#{LIST.map { |m| Regexp.escape m }.join}]/
96
+ end # module PathSeparators
97
+
98
+ # Invalid shell characters
99
+ module Shell
100
+
101
+ # The list of characters
102
+ LIST = [
103
+
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
+
116
+ # @!visibility private
117
+ def self.extended receiver # :nodoc:
118
+
119
+ receiver.class_eval do
120
+
121
+ extend LibPath_Constants_Windows_Details
122
+ end
123
+
124
+ $stderr.puts "#{receiver} extended by #{LibPath_Constants_Windows_Details}" if $DEBUG
125
+ end
126
+
127
+ # @!visibility private
128
+ def self.included receiver # :nodoc:
129
+
130
+ receiver.class_eval do
131
+
132
+ include LibPath_Constants_Windows_Details
133
+ end
134
+
135
+ $stderr.puts "#{receiver} included #{LibPath_Constants_Windows_Details}" if $DEBUG
136
+ end
137
+
138
+ extend LibPath_Constants_Windows_Details
139
+ include LibPath_Constants_Windows_Details
140
+
141
+ end # module Windows
142
+ end # module Constants
143
+ end # module LibPath
144
+
145
+ # ############################## end of file ############################# #
146
+
147
+