summaryrefslogtreecommitdiff
path: root/dir.rb
diff options
context:
space:
mode:
Diffstat (limited to 'dir.rb')
-rw-r--r--dir.rb29
1 files changed, 15 insertions, 14 deletions
diff --git a/dir.rb b/dir.rb
index 632c49eee9..eb1a408ee3 100644
--- a/dir.rb
+++ b/dir.rb
@@ -46,14 +46,14 @@
# The stream has a _position_, which is the index of an entry in the directory:
#
# - The initial position is zero (before the first entry).
-# - \Method #tell (aliased as #pos) returns the position.
-# - \Method #pos= sets the position (but ignores a value outside the stream),
+# - Method #tell (aliased as #pos) returns the position.
+# - Method #pos= sets the position (but ignores a value outside the stream),
# and returns the position.
-# - \Method #seek is like #pos=, but returns +self+ (convenient for chaining).
-# - \Method #read, if not at end-of-stream, reads the next entry and increments
+# - Method #seek is like #pos=, but returns +self+ (convenient for chaining).
+# - Method #read, if not at end-of-stream, reads the next entry and increments
# the position;
# if at end-of-stream, does not increment the position.
-# - \Method #rewind sets the position to zero.
+# - Method #rewind sets the position to zero.
#
# Examples (using the {simple file tree}[rdoc-ref:Dir@About+the+Examples]):
#
@@ -83,7 +83,7 @@
#
# == What's Here
#
-# First, what's elsewhere. \Class \Dir:
+# First, what's elsewhere. Class \Dir:
#
# - Inherits from {class Object}[rdoc-ref:Object@What-27s+Here].
# - Includes {module Enumerable}[rdoc-ref:Enumerable@What-27s+Here],
@@ -178,7 +178,7 @@ class Dir
# if +nil+ (the default), the file system's encoding is used:
#
# Dir.open('.').read.encoding # => #<Encoding:UTF-8>
- # Dir.open('.', encoding: 'US-ASCII').read.encoding # => #<Encoding:US-ASCII>
+ # Dir.open('.', encoding: Encoding::US_ASCII).read.encoding # => #<Encoding:US-ASCII>
#
def self.open(name, encoding: nil, &block)
dir = Primitive.dir_s_open(name, encoding)
@@ -206,7 +206,7 @@ class Dir
# if +nil+ (the default), the file system's encoding is used:
#
# Dir.new('.').read.encoding # => #<Encoding:UTF-8>
- # Dir.new('.', encoding: 'US-ASCII').read.encoding # => #<Encoding:US-ASCII>
+ # Dir.new('.', encoding: Encoding::US_ASCI).read.encoding # => #<Encoding:US-ASCII>
#
def initialize(name, encoding: nil)
Primitive.dir_initialize(name, encoding)
@@ -224,8 +224,8 @@ class Dir
end
# call-seq:
- # Dir.glob(*patterns, flags: 0, base: nil, sort: true) -> array
- # Dir.glob(*patterns, flags: 0, base: nil, sort: true) {|entry_name| ... } -> nil
+ # Dir.glob(patterns, flags: 0, base: nil, sort: true) -> array
+ # Dir.glob(patterns, flags: 0, base: nil, sort: true) {|entry_name| ... } -> nil
#
# Forms an array _entry_names_ of the entry names selected by the arguments.
#
@@ -319,14 +319,14 @@ class Dir
#
# Dir.glob('io.?') # => ["io.c"]
#
- # - <tt>'[_set_]'</tt>: Matches any one character in the string _set_;
+ # - <tt>'[set]'</tt>: Matches any one character in the string _set_;
# behaves like a {Regexp character class}[rdoc-ref:Regexp@Character+Classes],
# including set negation (<tt>'[^a-z]'</tt>):
#
# Dir.glob('*.[a-z][a-z]').take(3)
# # => ["CONTRIBUTING.md", "COPYING.ja", "KNOWNBUGS.rb"]
#
- # - <tt>'{_abc_,_xyz_}'</tt>:
+ # - <tt>'{abc,xyz}'</tt>:
# Matches either string _abc_ or string _xyz_;
# behaves like {Regexp alternation}[rdoc-ref:Regexp@Alternation]:
#
@@ -388,10 +388,10 @@ class Dir
#
# - File::FNM_EXTGLOB:
# enables the pattern extension
- # <tt>'{_a_,_b_}'</tt>, which matches pattern _a_ and pattern _b_;
+ # <tt>'{a,b}'</tt>, which matches pattern _a_ and pattern _b_;
# behaves like a
# {regexp union}[rdoc-ref:Regexp.union]
- # (e.g., <tt>'(?:_a_|_b_)'</tt>):
+ # (e.g., <tt>'(?:a|b)'</tt>):
#
# pattern = '{LEGAL,BSDL}'
# Dir.glob(pattern) # => ["LEGAL", "BSDL"]
@@ -408,6 +408,7 @@ class Dir
# specifies that patterns may match short names if they exist; Windows only.
#
def self.glob(pattern, _flags = 0, flags: _flags, base: nil, sort: true)
+ Primitive.attr! :use_block
Primitive.dir_s_glob(pattern, flags, base, sort)
end
end