Class: Pathname
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #absolute? ⇒ Boolean
-
#initialize(path) ⇒ Pathname
constructor
A new instance of Pathname.
- #relative? ⇒ Boolean
- #to_path ⇒ Object (also: #to_str, #to_s)
Constructor Details
#initialize(path) ⇒ Pathname
Returns a new instance of Pathname
2 3 4 5 |
# File 'opal/stdlib/pathname.rb', line 2 def initialize path raise ArgumentError if path == "\0" @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path
7 8 9 |
# File 'opal/stdlib/pathname.rb', line 7 def path @path end |
Instance Method Details
#==(other) ⇒ Object
9 10 11 |
# File 'opal/stdlib/pathname.rb', line 9 def == other other.path == @path end |
#absolute? ⇒ Boolean
13 14 15 |
# File 'opal/stdlib/pathname.rb', line 13 def absolute? @path.start_with? '/' end |
#relative? ⇒ Boolean
17 18 19 |
# File 'opal/stdlib/pathname.rb', line 17 def relative? !absolute? end |
#to_path ⇒ Object Also known as: to_str, to_s
21 22 23 |
# File 'opal/stdlib/pathname.rb', line 21 def to_path @path end |