Module: Pa::Path
- Included in:
- Pa
- Defined in:
- lib/tagen/core/pa/path.rb
Overview
attribute absolute and dir return String, method absolute_path(), dirname() return Pa Pa("/home/a").dir #=> "/home" Pa("/home/a").dirname #=> Pa("/home")
methods from String
-
+
- g]sub[!
-
match =~
-
start_with? end_with?
Instance Attribute Summary (collapse)
- - (String) absolute (also: #a) readonly
- - (String) base (also: #b) readonly
- - (String) dir (also: #d) readonly
- - (String) ext (also: #e) readonly
- - (String) fext (also: #fe) readonly
- - (String) name (also: #n) readonly
- - (String) short readonly
Instance Method Summary (collapse)
-
- (Pa) +(str)
add string to path.
- - (Object) ==(other)
- - (Object) =~(regexp)
-
- (Pa) absolute2
Absolute path.
-
- (Pa) dir2
Dirname.
- - (Boolean) end_with?(*args)
- - (Pa) gsub(*args, &blk)
- - (Pa) gsub!(*args, &blk)
- - (Object) initialize_variables
- - (MatchData) match(*args, &blk)
- - (Boolean) start_with?(*args)
- - (Pa) sub(*args, &blk)
- - (Pa) sub!(*args, &blk)
Instance Attribute Details
- (String) absolute (readonly) Also known as: a
232 233 234 |
# File 'lib/tagen/core/pa/path.rb', line 232 def absolute @absolute end |
- (String) base (readonly) Also known as: b
232 233 234 |
# File 'lib/tagen/core/pa/path.rb', line 232 def base @base end |
- (String) dir (readonly) Also known as: d
232 233 234 |
# File 'lib/tagen/core/pa/path.rb', line 232 def dir @dir end |
- (String) ext (readonly) Also known as: e
232 233 234 |
# File 'lib/tagen/core/pa/path.rb', line 232 def ext @ext end |
- (String) fext (readonly) Also known as: fe
232 233 234 |
# File 'lib/tagen/core/pa/path.rb', line 232 def fext @fext end |
- (String) name (readonly) Also known as: n
232 233 234 |
# File 'lib/tagen/core/pa/path.rb', line 232 def name @name end |
- (String) short (readonly)
232 233 234 |
# File 'lib/tagen/core/pa/path.rb', line 232 def short @short ||= Pa.shorten(@path) end |
Instance Method Details
- (Pa) +(str)
add string to path
271 |
# File 'lib/tagen/core/pa/path.rb', line 271 def +(str) Pa(path+str) end |
- (Object) ==(other)
296 |
# File 'lib/tagen/core/pa/path.rb', line 296 def ==(other) self.path == other.path end |
- (Object) =~(regexp)
294 |
# File 'lib/tagen/core/pa/path.rb', line 294 def =~(regexp) path =~ regexp end |
- (Pa) absolute2
Absolute path
256 |
# File 'lib/tagen/core/pa/path.rb', line 256 def absolute2() @absolute2 ||= Pa(absolute) end |
- (Pa) dir2
Dirname
261 |
# File 'lib/tagen/core/pa/path.rb', line 261 def dir2() @dir2 ||= Pa(dir) end |
- (Boolean) end_with?(*args)
292 |
# File 'lib/tagen/core/pa/path.rb', line 292 def end_with?(*args) path.end_with?(*args) end |
- (Pa) gsub(*args, &blk)
277 |
# File 'lib/tagen/core/pa/path.rb', line 277 def gsub(*args,&blk) Pa(path.gsub(*args,&blk)) end |
- (Pa) gsub!(*args, &blk)
283 |
# File 'lib/tagen/core/pa/path.rb', line 283 def gsub!(*args,&blk) self.replace path.gsub(*args,&blk) end |
- (Object) initialize_variables
234 235 236 237 238 239 240 241 242 |
# File 'lib/tagen/core/pa/path.rb', line 234 def initialize_variables super @absolute = File.absolute_path(@path) @dir = File.dirname(@path) @base = File.basename(@path) @name, @ext = @base.match(NAME_EXT_PAT).captures @ext ||= "" @fext = @ext.empty? ? "" : "."+@ext end |
- (MatchData) match(*args, &blk)
286 |
# File 'lib/tagen/core/pa/path.rb', line 286 def match(*args,&blk) path.match(*args,&blk) end |
- (Boolean) start_with?(*args)
289 |
# File 'lib/tagen/core/pa/path.rb', line 289 def start_with?(*args) path.start_with?(*args) end |
- (Pa) sub(*args, &blk)
274 |
# File 'lib/tagen/core/pa/path.rb', line 274 def sub(*args,&blk) Pa(path.sub(*args,&blk)) end |
- (Pa) sub!(*args, &blk)
280 |
# File 'lib/tagen/core/pa/path.rb', line 280 def sub!(*args,&blk) self.replace path.sub(*args,&blk) end |