File tree 2 files changed +26
-9
lines changed
2 files changed +26
-9
lines changed Original file line number Diff line number Diff line change @@ -256,6 +256,7 @@ corelib/language/while_spec
256
256
257
257
stdlib/rubysl-singleton/spec/
258
258
stdlib/rubysl-observer/spec/
259
+ stdlib/rubysl-pathname/spec/
259
260
260
261
stdlib/rubysl-strscan/spec/bol_spec
261
262
stdlib/rubysl-strscan/spec/check_spec
@@ -315,14 +316,6 @@ stdlib/rubysl-set/spec/to_a_spec
315
316
# stdlib/rubysl-set/spec/superset_spec
316
317
# stdlib/rubysl-set/spec/union_spec
317
318
318
-
319
-
320
-
321
- stdlib/rubysl-pathname/spec/new_spec
322
- stdlib/rubysl-pathname/spec/equal_value_spec
323
- stdlib/rubysl-pathname/spec/absolute_spec
324
- stdlib/rubysl-pathname/spec/relative_spec
325
-
326
319
stdlib/rubysl-date/spec/date/add_spec
327
320
stdlib/rubysl-date/spec/date/eql_spec
328
321
stdlib/rubysl-date/spec/date/minus_spec
Original file line number Diff line number Diff line change 1
1
class Pathname
2
- def initialize path
2
+ def initialize ( path )
3
3
raise ArgumentError if path == "\0 "
4
4
@path = path
5
5
end
@@ -18,14 +18,38 @@ def relative?
18
18
!absolute?
19
19
end
20
20
21
+ def root?
22
+ @path == '/'
23
+ end
24
+
25
+ def parent
26
+ new_path = @path . sub ( %r{/([^/]+/?$)} , '' )
27
+ new_path = absolute? ? '/' : '.' if new_path == ''
28
+ Pathname . new ( new_path )
29
+ end
30
+
31
+ def sub ( *args )
32
+ Pathname . new ( @path . sub ( *args ) )
33
+ end
34
+
35
+ def cleanpath
36
+ `return $opal.normalize_loadable_path(#@path )`
37
+ end
38
+
21
39
def to_path
22
40
@path
23
41
end
42
+
43
+ def hash
44
+ @path
45
+ end
46
+
24
47
alias :to_str :to_path
25
48
alias :to_s :to_path
26
49
end
27
50
28
51
module Kernel
29
52
def Pathname ( path )
53
+ Pathname . new ( path )
30
54
end
31
55
end
You can’t perform that action at this time.
0 commit comments