recls-ruby 2.8.2 → 2.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +57 -10
  3. data/examples/find_files_and_directories.md +77 -0
  4. data/examples/find_files_and_directories.rb +19 -0
  5. data/examples/find_files_and_directories.recursive.md +304 -0
  6. data/examples/find_files_and_directories.recursive.rb +19 -0
  7. data/examples/show_hidden_files.md +39 -0
  8. data/examples/show_hidden_files.rb +2 -2
  9. data/examples/show_readonly_files.md +35 -0
  10. data/examples/show_readonly_files.rb +2 -2
  11. data/lib/recls.rb +2 -0
  12. data/lib/recls/api.rb +70 -3
  13. data/lib/recls/combine_paths_1.rb +70 -0
  14. data/lib/recls/combine_paths_2plus.rb +76 -0
  15. data/lib/recls/entry.rb +40 -4
  16. data/lib/recls/file_search.rb +48 -14
  17. data/lib/recls/flags.rb +21 -4
  18. data/lib/recls/foreach.rb +45 -6
  19. data/lib/recls/obsolete.rb +119 -0
  20. data/lib/recls/recls.rb +27 -56
  21. data/lib/recls/stat.rb +96 -24
  22. data/lib/recls/util.rb +74 -23
  23. data/lib/recls/version.rb +10 -4
  24. data/lib/recls/ximpl/os.rb +29 -15
  25. data/lib/recls/ximpl/unix.rb +29 -16
  26. data/lib/recls/ximpl/util.rb +141 -39
  27. data/lib/recls/ximpl/windows.rb +56 -25
  28. data/test/fixtures/readonly/file-1 +0 -0
  29. data/test/fixtures/readonly/file-2 +0 -0
  30. data/test/scratch/test_display_parts.rb +9 -9
  31. data/test/scratch/test_entry.rb +11 -9
  32. data/test/scratch/test_files_and_directories.rb +17 -14
  33. data/test/scratch/test_foreach.rb +0 -3
  34. data/test/scratch/test_module_function.rb +10 -10
  35. data/test/scratch/test_pattern_arrays.rb +32 -0
  36. data/test/scratch/test_show_dev_and_ino.rb +1 -1
  37. data/test/scratch/test_show_hidden.rb +3 -3
  38. data/test/unit/tc_recls_util.rb +6 -0
  39. data/test/unit/tc_recls_ximpl_util.rb +156 -101
  40. data/test/unit/ts_all.rb +11 -9
  41. metadata +36 -11
@@ -0,0 +1,19 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
4
+
5
+ require 'recls'
6
+
7
+ puts "files under current directory:"
8
+ Recls.file_rsearch(nil, nil, Recls::FILES).each { |fe| puts "\t#{fe.search_relative_path}" }
9
+ puts
10
+
11
+ puts "directories under current directory:"
12
+ Recls.file_rsearch(nil, nil, Recls::DIRECTORIES | Recls::MARK_DIRECTORIES).each { |fe| puts "\t#{fe.search_relative_path}" }
13
+ puts
14
+
15
+ puts "files and directories under current directory:"
16
+ Recls.file_rsearch(nil, nil, Recls::DIRECTORIES | Recls::FILES | Recls::MARK_DIRECTORIES).each { |fe| puts "\t#{fe.search_relative_path}" }
17
+ puts
18
+
19
+
@@ -0,0 +1,39 @@
1
+ # recls.Ruby Example - **show_hidden_files**
2
+
3
+ ## Summary
4
+
5
+ TBC
6
+
7
+ ## Source
8
+
9
+ ```ruby
10
+ #! /usr/bin/env ruby
11
+
12
+ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
13
+
14
+ require 'recls'
15
+
16
+ # To find only hidden files, need to:
17
+ #
18
+ # 1. Ensure that they are returned in search, by including Recls::SHOW_HIDDEN
19
+ # 2. Filter returned entries by hidden? attribute
20
+ Recls.file_rsearch('.', Recls::WILDCARDS_ALL, Recls::FILES | Recls::SHOW_HIDDEN).each do |fe|
21
+
22
+ puts fe.path if fe.hidden?
23
+ end
24
+ ```
25
+
26
+ ## Discussion
27
+
28
+ TBC
29
+
30
+ ## Example results
31
+
32
+ ```
33
+ /Users/matthewwilson/dev/freelibs/recls/100/recls.Ruby/trunk/.gitignore
34
+ /Users/matthewwilson/dev/freelibs/recls/100/recls.Ruby/trunk/.ruby-version
35
+ /Users/matthewwilson/dev/freelibs/recls/100/recls.Ruby/trunk/.ruby-version-exclusions
36
+ /Users/matthewwilson/dev/freelibs/recls/100/recls.Ruby/trunk/test/fixtures/hidden/.file-1
37
+ /Users/matthewwilson/dev/freelibs/recls/100/recls.Ruby/trunk/test/fixtures/hidden/.file-2
38
+ ```
39
+
@@ -1,3 +1,4 @@
1
+ #! /usr/bin/env ruby
1
2
 
2
3
  $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
3
4
 
@@ -7,9 +8,8 @@ require 'recls'
7
8
  #
8
9
  # 1. Ensure that they are returned in search, by including Recls::SHOW_HIDDEN
9
10
  # 2. Filter returned entries by hidden? attribute
10
- Recls::FileSearch.new('.', Recls::WILDCARDS_ALL, Recls::FILES | Recls::RECURSIVE | Recls::SHOW_HIDDEN).each do |fe|
11
+ Recls.file_rsearch('.', Recls::WILDCARDS_ALL, Recls::FILES | Recls::SHOW_HIDDEN).each do |fe|
11
12
 
12
13
  puts fe.path if fe.hidden?
13
-
14
14
  end
15
15
 
@@ -0,0 +1,35 @@
1
+ # recls.Ruby Example - **show_hidden_files**
2
+
3
+ ## Summary
4
+
5
+ TBC
6
+
7
+ ## Source
8
+
9
+ ```ruby
10
+ #! /usr/bin/env ruby
11
+
12
+ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
13
+
14
+ require 'recls'
15
+
16
+ # To find only readonly files, need to:
17
+ #
18
+ # 1. Filter returned entries by readonly? attribute
19
+ Recls.file_rsearch('.', Recls::WILDCARDS_ALL, Recls::FILES).each do |fe|
20
+
21
+ puts fe.path if fe.readonly?
22
+ end
23
+ ```
24
+
25
+ ## Discussion
26
+
27
+ TBC
28
+
29
+ ## Example results
30
+
31
+ ```
32
+ /Users/matthewwilson/dev/freelibs/recls/100/recls.Ruby/trunk/test/fixtures/readonly/file-1
33
+ /Users/matthewwilson/dev/freelibs/recls/100/recls.Ruby/trunk/test/fixtures/readonly/file-2
34
+ ```
35
+
@@ -1,3 +1,4 @@
1
+ #! /usr/bin/env ruby
1
2
 
2
3
  $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
3
4
 
@@ -6,9 +7,8 @@ require 'recls'
6
7
  # To find only readonly files, need to:
7
8
  #
8
9
  # 1. Filter returned entries by readonly? attribute
9
- Recls::FileSearch.new('.', Recls::WILDCARDS_ALL, Recls::FILES | Recls::RECURSIVE).each do |fe|
10
+ Recls.file_rsearch('.', Recls::WILDCARDS_ALL, Recls::FILES).each do |fe|
10
11
 
11
12
  puts fe.path if fe.readonly?
12
-
13
13
  end
14
14
 
@@ -39,3 +39,5 @@
39
39
  require 'recls/recls'
40
40
 
41
41
  # ############################## end of file ############################# #
42
+
43
+
@@ -4,11 +4,11 @@
4
4
  # Purpose: Defines Recls module search functions
5
5
  #
6
6
  # Created: 9th June 2016
7
- # Updated: 9th June 2016
7
+ # Updated: 14th April 2019
8
8
  #
9
9
  # Author: Matthew Wilson
10
10
  #
11
- # Copyright (c) 2016, Matthew Wilson and Synesis Software
11
+ # Copyright (c) 2016-2019, Matthew Wilson and Synesis Software
12
12
  # All rights reserved.
13
13
  #
14
14
  # Redistribution and use in source and binary forms, with or without
@@ -37,14 +37,81 @@
37
37
 
38
38
 
39
39
  require 'recls/file_search'
40
+ require 'recls/flags'
41
+
42
+ =begin
43
+ =end
44
+
45
+ class Object; end # :nodoc:
40
46
 
41
47
  module Recls
42
48
 
49
+ # [DEPRECATED] Use Recls::file_search()
43
50
  def self.FileSearch(search_root, patterns, options = {})
44
51
 
45
52
  Recls::FileSearch.new(search_root, patterns, options)
46
53
  end
47
- end
54
+
55
+ # Initialises a +FileSearch+ instance, which acts recursively, as an
56
+ # +Enumerable+ of Recls::Entry
57
+ #
58
+ # === Signature
59
+ #
60
+ # * *Parameters:*
61
+ # - +search_root+ (String, Recls::Entry) The root directory of the search. May be +nil+, in which case the current directory is assumed
62
+ # - +patterns+ (String, Array) The pattern(s) for which to search. May be +nil+, in which case Recls::WILDCARDS_ALL is assumed
63
+ # - +options+ (Hash, Integer) Combination of flags (with behaviour as described below for the +flags+ option), or an options hash
64
+ #
65
+ # * *Options:*
66
+ # - +flags+ (Integer) Combination of flags - FILES, DIRECTORIES, etc. If the value modulo TYPEMASK is 0, then FILES is assumed. The value RECURSIVE is added by the function, and so need not be added by the caller; it cannot be removed
67
+ #
68
+ # === Return
69
+ # An instance of a class implementing ::Enumerable whose value type is
70
+ # Recls::Entry
71
+ def self.file_rsearch(search_root, patterns, options = {})
72
+
73
+ case options
74
+ when ::NilClass
75
+
76
+ options = { flags: RECURSIVE }
77
+ when ::Integer
78
+
79
+ options |= RECURSIVE
80
+ when ::Hash
81
+
82
+ flags = options[:flags] || 0
83
+ flags |= RECURSIVE
84
+
85
+ options[:flags] = flags
86
+ else
87
+
88
+ # this is handled by the FileSearch initialiser
89
+ end
90
+
91
+ Recls::FileSearch.new(search_root, patterns, options)
92
+ end
93
+
94
+ # Initialises a +FileSearch+ instance, which acts as an +Enumerable+
95
+ # of Recls::Entry
96
+ #
97
+ # === Signature
98
+ #
99
+ # * *Parameters:*
100
+ # - +search_root+ (String, Recls::Entry) The root directory of the search. May be +nil+, in which case the current directory is assumed
101
+ # - +patterns+ (String, Array) The pattern(s) for which to search. May be +nil+, in which case Recls::WILDCARDS_ALL is assumed
102
+ # - +options+ (Hash, Integer) Combination of flags (with behaviour as described below for the +flags+ option), or an options hash
103
+ #
104
+ # * *Options:*
105
+ # - +flags+ (Integer) Combination of flags - FILES, DIRECTORIES, RECURSIVE, etc. If the value modulo TYPEMASK is 0, then FILES is assumed
106
+ #
107
+ # === Return
108
+ # An instance of a class implementing ::Enumerable whose value type is
109
+ # Recls::Entry
110
+ def self.file_search(search_root, patterns, options = {})
111
+
112
+ Recls::FileSearch.new(search_root, patterns, options)
113
+ end
114
+ end # module Recls
48
115
 
49
116
  # ############################## end of file ############################# #
50
117
 
@@ -0,0 +1,70 @@
1
+ # ######################################################################### #
2
+ # File: recls/compare_paths_1.rb
3
+ #
4
+ # Purpose: Definition of Recls::compare_paths() for Ruby 1.x
5
+ #
6
+ # Created: 17th February 2014
7
+ # Updated: 14th April 2019
8
+ #
9
+ # Author: Matthew Wilson
10
+ #
11
+ # Copyright (c) 2014-2019, Matthew Wilson and Synesis Software
12
+ # All rights reserved.
13
+ #
14
+ # Redistribution and use in source and binary forms, with or without
15
+ # modification, are permitted provided that the following conditions are met:
16
+ #
17
+ # * Redistributions of source code must retain the above copyright notice,
18
+ # this list of conditions and the following disclaimer.
19
+ #
20
+ # * Redistributions in binary form must reproduce the above copyright notice,
21
+ # this list of conditions and the following disclaimer in the documentation
22
+ # and/or other materials provided with the distribution.
23
+ #
24
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27
+ # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
28
+ # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29
+ # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30
+ # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32
+ # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33
+ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34
+ # POSSIBILITY OF SUCH DAMAGE.
35
+ #
36
+ # ######################################################################### #
37
+
38
+
39
+ require 'recls/ximpl/util'
40
+
41
+ =begin
42
+ =end
43
+
44
+ class Object; end # :nodoc:
45
+
46
+ module Recls
47
+
48
+ # Combines paths
49
+ #
50
+ # === Signature
51
+ #
52
+ # * *Parameters:*
53
+ # - +paths+ ([ (::String, ::Recls::Entry) ]) Array of 1 or more path elements to be combined
54
+ #
55
+ # === Return
56
+ # (String) The combined path
57
+ def self.combine_paths(*paths)
58
+
59
+ paths = paths.reject { |p| p.nil? }
60
+ paths = paths.map { |p| 'Recls::Entry' == p.class.to_s ? p.path : p }
61
+
62
+ raise ArgumentError, 'must specify one or more path elements' if paths.empty?
63
+
64
+ return Recls::Ximpl.combine_paths paths, {}
65
+ end
66
+ end # module Recls
67
+
68
+ # ############################## end of file ############################# #
69
+
70
+
@@ -0,0 +1,76 @@
1
+ # ######################################################################### #
2
+ # File: recls/compare_paths_2plus.rb
3
+ #
4
+ # Purpose: Definition of Recls::compare_paths() for Ruby 2+
5
+ #
6
+ # Created: 17th February 2014
7
+ # Updated: 14th April 2019
8
+ #
9
+ # Author: Matthew Wilson
10
+ #
11
+ # Copyright (c) 2014-2019, Matthew Wilson and Synesis Software
12
+ # All rights reserved.
13
+ #
14
+ # Redistribution and use in source and binary forms, with or without
15
+ # modification, are permitted provided that the following conditions are met:
16
+ #
17
+ # * Redistributions of source code must retain the above copyright notice,
18
+ # this list of conditions and the following disclaimer.
19
+ #
20
+ # * Redistributions in binary form must reproduce the above copyright notice,
21
+ # this list of conditions and the following disclaimer in the documentation
22
+ # and/or other materials provided with the distribution.
23
+ #
24
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27
+ # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
28
+ # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29
+ # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30
+ # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32
+ # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33
+ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34
+ # POSSIBILITY OF SUCH DAMAGE.
35
+ #
36
+ # ######################################################################### #
37
+
38
+
39
+ require 'recls/ximpl/util'
40
+
41
+ =begin
42
+ =end
43
+
44
+ class Object; end # :nodoc:
45
+
46
+ module Recls
47
+
48
+ # Combines paths, optionally canonicalising them
49
+ #
50
+ # === Signature
51
+ #
52
+ # * *Parameters:*
53
+ # - +paths+ ([ (::String, ::Recls::Entry) ]) Array of 1 or more path elements to be combined
54
+ # - +options+ (::Hash) Options that moderate the combination
55
+ #
56
+ # * *Options:*
57
+ # - +:canonicalise+ (boolean) Causes the evaluated path to be canonicalised - with +Recls.canonicalise_path+ - before it is returned
58
+ # - +:clean+ (boolean) Causes the evaluated path to be cleaned (i.e. sent to +cleanpath+) before it is returned. Ignored if +:canonicalise+ is specified
59
+ # - +:clean_path+ (boolean) Equivalent to +:clean+, but deprecated and may be removed in a future version
60
+ #
61
+ # === Return
62
+ # (String) The combined path
63
+ def self.combine_paths(*paths, **options)
64
+
65
+ paths = paths.reject { |p| p.nil? }
66
+ paths = paths.map { |p| 'Recls::Entry' == p.class.to_s ? p.path : p }
67
+
68
+ raise ArgumentError, 'must specify one or more path elements' if paths.empty?
69
+
70
+ return Recls::Ximpl.combine_paths paths, options
71
+ end
72
+ end # module Recls
73
+
74
+ # ############################## end of file ############################# #
75
+
76
+
@@ -4,11 +4,12 @@
4
4
  # Purpose: Defines the Recls::Entry class for the recls.Ruby library.
5
5
  #
6
6
  # Created: 24th July 2012
7
- # Updated: 11th July 2016
7
+ # Updated: 25th May 2020
8
8
  #
9
9
  # Author: Matthew Wilson
10
10
  #
11
- # Copyright (c) 2012-2016, Matthew Wilson and Synesis Software
11
+ # Copyright (c) 2019-2020, Matthew Wilson and Synesis Information Systems
12
+ # Copyright (c) 2012-2019, Matthew Wilson and Synesis Software
12
13
  # All rights reserved.
13
14
  #
14
15
  # Redistribution and use in source and binary forms, with or without
@@ -41,11 +42,18 @@ require 'recls/ximpl/' + (Recls::Ximpl::OS::OS_IS_WINDOWS ? 'windows' : 'unix')
41
42
  require 'recls/ximpl/util'
42
43
  require 'recls/flags'
43
44
 
45
+ =begin
46
+ =end
47
+
48
+ class Object; end # :nodoc:
49
+
44
50
  module Recls
45
51
 
52
+ # A file-system entry
46
53
  class Entry
47
54
 
48
55
  private
56
+ # @!visibility private
49
57
  def self.get_compare_path_(path)
50
58
  return path.upcase if Recls::Ximpl::OS::OS_IS_WINDOWS
51
59
  path
@@ -90,6 +98,7 @@ module Recls
90
98
  @nlink = @file_stat.nlink if @file_stat
91
99
 
92
100
  if Recls::Ximpl::OS::OS_IS_WINDOWS && @file_stat
101
+
93
102
  @dev = @file_stat.by_handle_information.volume_id
94
103
  @ino = @file_stat.by_handle_information.file_index
95
104
  @nlink = @file_stat.by_handle_information.num_links
@@ -102,26 +111,43 @@ module Recls
102
111
  # ##########################
103
112
  # Name-related attributes
104
113
 
114
+ # (String) A normalised form of #path that can be used in comparisons
105
115
  attr_reader :compare_path
106
116
 
117
+ # (String) The full-path of the instance
107
118
  attr_reader :path
119
+ # (String) The (Windows) short-form of #path, or +nil+ if not on Windows
108
120
  attr_reader :short_path
121
+ # (String) The (Windows) drive. +nil+ if does not exist
109
122
  attr_reader :drive
123
+ # (String) The full path of the entry's directory (taking into account the
124
+ # #drive if on Windows)
110
125
  attr_reader :directory_path
111
126
  alias_method :dirname, :directory_path
127
+ # (String) The entry's directory (excluding the #drive if on Windows)
112
128
  attr_reader :directory
129
+ # ([String]) An array of directory parts, where each part ends in Recls::PATH_NAME_SEPARATOR
113
130
  attr_reader :directory_parts
131
+ # (String) The entry's file name (combination of #stem + #extension)
114
132
  attr_reader :file_full_name
133
+ # (String) The (Windows) short-form of #basename, or +nil+ if not on Windows
115
134
  attr_reader :file_short_name
116
135
  alias_method :basename, :file_full_name
136
+ # (String) The entry's file stem
117
137
  attr_reader :file_name_only
118
138
  alias_method :stem, :file_name_only
139
+ # (String) The entry's file extension
119
140
  attr_reader :file_extension
120
141
  alias_method :extension, :file_extension
142
+ # (String) The search directory if specified; +nil+ otherwise
121
143
  attr_reader :search_directory
144
+ # (String) The #path relative to #search_directory; +nil+ if no search directory specified
122
145
  attr_reader :search_relative_path
146
+ # (String) The #directory relative to #search_directory; +nil+ if no search directory specified
123
147
  attr_reader :search_relative_directory
148
+ # (String) The #directory_path relative to #search_directory; +nil+ if no search directory specified
124
149
  attr_reader :search_relative_directory_path
150
+ # ([String]) The #directory_parts relative to #search_directory; +nil+ if no search directory specified
125
151
  attr_reader :search_relative_directory_parts
126
152
 
127
153
  # ##########################
@@ -157,6 +183,7 @@ module Recls
157
183
 
158
184
  if Recls::Ximpl::OS::OS_IS_WINDOWS
159
185
 
186
+ # [WINDOWS-ONLY] Indicates whether the entry has the *system* bit
160
187
  def system?
161
188
 
162
189
  return false if @file_stat.nil?
@@ -164,6 +191,7 @@ module Recls
164
191
  @file_stat.system?
165
192
  end
166
193
 
194
+ # [WINDOWS-ONLY] Indicates whether the entry has the *archive* bit
167
195
  def archive?
168
196
 
169
197
  return false if @file_stat.nil?
@@ -171,6 +199,7 @@ module Recls
171
199
  @file_stat.archive?
172
200
  end
173
201
 
202
+ # [WINDOWS-ONLY] Indicates whether the entry is a device
174
203
  def device?
175
204
 
176
205
  return false if @file_stat.nil?
@@ -178,6 +207,7 @@ module Recls
178
207
  @file_stat.device?
179
208
  end
180
209
 
210
+ # [WINDOWS-ONLY] Indicates whether the entry is *normal*
181
211
  def normal?
182
212
 
183
213
  return false if @file_stat.nil?
@@ -185,6 +215,7 @@ module Recls
185
215
  @file_stat.normal?
186
216
  end
187
217
 
218
+ # [WINDOWS-ONLY] Indicates whether the entry has the *temporary* bit
188
219
  def temporary?
189
220
 
190
221
  return false if @file_stat.nil?
@@ -192,6 +223,7 @@ module Recls
192
223
  @file_stat.temporary?
193
224
  end
194
225
 
226
+ # [WINDOWS-ONLY] Indicates whether the entry has the *compressed* bit
195
227
  def compressed?
196
228
 
197
229
  return false if @file_stat.nil?
@@ -199,6 +231,7 @@ module Recls
199
231
  @file_stat.compressed?
200
232
  end
201
233
 
234
+ # [WINDOWS-ONLY] Indicates whether the entry has the *encrypted* bit
202
235
  def encrypted?
203
236
 
204
237
  return false if @file_stat.nil?
@@ -215,6 +248,8 @@ module Recls
215
248
  @file_stat.directory?
216
249
  end
217
250
 
251
+ alias_method :dir?, :directory?
252
+
218
253
  # indicates whether the given entry represents a file
219
254
  def file?
220
255
 
@@ -355,8 +390,9 @@ module Recls
355
390
 
356
391
  path
357
392
  end
358
- end
359
- end
393
+ end # class Entry
394
+ end # module Recls
360
395
 
361
396
  # ############################## end of file ############################# #
362
397
 
398
+