Module: Alt::URI::Ops::PathParts
- Included in:
- Base
- Defined in:
- lib/rio/alturi.rb,
lib/rio/alturi/path_parts.rb
Instance Method Summary collapse
- #basename(exnam = nil) ⇒ Object
- #basename=(val) ⇒ Object
- #dirname ⇒ Object
- #dirname=(val) ⇒ Object
- #extname ⇒ Object
- #extname=(val) ⇒ Object
- #filename ⇒ Object
- #filename=(val) ⇒ Object
- #netpath ⇒ Object
Instance Method Details
#basename(exnam = nil) ⇒ Object
13 14 15 16 |
# File 'lib/rio/alturi/path_parts.rb', line 13 def basename(exnam=nil) exnam ||= self.ext self.path[*_bn_pos(self.path,exnam)] end |
#basename=(val) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/rio/alturi/path_parts.rb', line 20 def basename=(val) pth = self.path pth[*_bn_pos(pth)] = val self.path = pth basename end |
#dirname ⇒ Object
6 7 8 9 |
# File 'lib/rio/alturi/path_parts.rb', line 6 def dirname dn = self.path[*_dn_pos(self.path)] dn.empty? ? "." : dn end |
#dirname=(val) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/rio/alturi/path_parts.rb', line 34 def dirname=(val) pth = self.path pth = "./" + pth if dirname == "." pth[*_dn_pos(pth)] = val self.path = pth.squeeze("/") dirname end |
#extname ⇒ Object
17 18 19 |
# File 'lib/rio/alturi/path_parts.rb', line 17 def extname self.path[*_en_pos(self.path,self.ext)] end |
#extname=(val) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/rio/alturi/path_parts.rb', line 26 def extname=(val) # p "extname=(#{val})" pth = self.path pth[*_en_pos(pth,self.ext)] = val self.path = pth self.ext = val extname end |
#filename ⇒ Object
10 11 12 |
# File 'lib/rio/alturi/path_parts.rb', line 10 def filename self.path[*_fn_pos(self.path)] end |
#filename=(val) ⇒ Object
41 42 43 44 45 46 |
# File 'lib/rio/alturi/path_parts.rb', line 41 def filename=(val) pth = self.path pth[*_fn_pos(pth)] = val self.path = pth.squeeze("/") filename end |
#netpath ⇒ Object
40 41 42 |
# File 'lib/rio/alturi.rb', line 40 def netpath _netpath_scheme end |