Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/gumdrop/util/core_ex.rb
Instance Method Summary collapse
- #/(other) ⇒ Object
- #expand_path(relative_to = nil) ⇒ Object
- #path_match?(pattern) ⇒ Boolean
- #relative ⇒ Object
- #relative! ⇒ Object
Instance Method Details
#/(other) ⇒ Object
27 28 29 |
# File 'lib/gumdrop/util/core_ex.rb', line 27 def / (other) File.join self, other end |
#expand_path(relative_to = nil) ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/gumdrop/util/core_ex.rb', line 40 def (relative_to=nil) if (Pathname.new self).absolute? self elsif relative_to.nil? File. self else File. relative_to / self end end |
#path_match?(pattern) ⇒ Boolean
50 51 52 |
# File 'lib/gumdrop/util/core_ex.rb', line 50 def path_match?(pattern) File.fnmatch pattern, self, File::FNM_PATHNAME | File::FNM_DOTMATCH | File::FNM_CASEFOLD end |
#relative ⇒ Object
31 32 33 |
# File 'lib/gumdrop/util/core_ex.rb', line 31 def relative dup.relative! end |
#relative! ⇒ Object
35 36 37 38 |
# File 'lib/gumdrop/util/core_ex.rb', line 35 def relative! sub! /^[\/]/, '' self end |