@@ -28,10 +28,10 @@ unless when stated otherwise.
28
28
= head2 method new
29
29
30
30
multi method new(Str:D $path)
31
- multi method new(:$basename!, :$directory = '.', :$volume = '')
31
+ multi method new(:$basename!, :$dirname = '.', :$volume = '')
32
32
33
33
Creates a new IO::Path object from a path string (which is being parsed for
34
- volume, directory and basename), or from volumen , directory and basename
34
+ volume, directory name and basename), or from volume , directory name and basename
35
35
passed as named arguments.
36
36
37
37
= head2 method abspath
@@ -47,14 +47,14 @@ the file relative to to its directory.
47
47
48
48
say IO::Path.new("/etc/passwd").basename; # passwd
49
49
50
- = head2 method directory
50
+ = head2 method dirname
51
51
52
- method directory (IO::Path:D)
52
+ method dirname (IO::Path:D)
53
53
54
- Returns the directory portion of the path object. That is, it returns the path
54
+ Returns the directory name portion of the path object. That is, it returns the path
55
55
excluding the volume and the base name.
56
56
57
- say IO::Path.new("/etc/passwd").directory; # /etc
57
+ say IO::Path.new("/etc/passwd").dirname; # /etc
58
58
59
59
= head2 method volume
60
60
@@ -69,11 +69,11 @@ the empty string.
69
69
70
70
method parts(IO::Path:D) returns Hash
71
71
72
- Returns a hash with the keys C < directory > , C < path > and C < volume > , and as
72
+ Returns a hash with the keys C < dirname > , C < path > and C < volume > , and as
73
73
values the return values of the methods with the same names.
74
74
75
75
say IO::Path.new("/etc/passwd").parts.perl
76
- # ("directory " => "/etc", "volume" => "", "basename" => "passwd").hash
76
+ # ("dirname " => "/etc", "volume" => "", "basename" => "passwd").hash
77
77
78
78
= head2 method path
79
79
@@ -126,9 +126,9 @@ Returns a new C<IO::Path> object that is an absolute path, based on C<$base>.
126
126
127
127
Returns a new C < IO::Path > object relative to the C < $base > path.
128
128
129
- = head2 method contents
129
+ = head2 method dir
130
130
131
- method contents (IO::Path:D: Mu :$test = none('.', '..'))
131
+ method dir (IO::Path:D: Mu :$test = none('.', '..'))
132
132
133
133
Tries to interpret the path as a directory, and returns a lazy list of
134
134
C < IO::Path > objects that match the C < $test > smart-matcher.
@@ -143,7 +143,7 @@ An example that lists all files and directories recursively:
143
143
sub MAIN($dir = '.') {
144
144
my @todo = $dir.path;
145
145
while @todo {
146
- for @todo.pop.contents -> $path {
146
+ for @todo.pop.dir -> $path {
147
147
say $path.Str;
148
148
@todo.push: $path if $path.d;
149
149
}
0 commit comments