Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/gumdrop/util/core_ex.rb

Instance Method Summary collapse

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 expand_path(relative_to=nil)
  if (Pathname.new self).absolute?
    self
  elsif relative_to.nil?
    File.expand_path self
  else
    File.expand_path relative_to / self
  end
end

#path_match?(pattern) ⇒ Boolean

Returns:

  • (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

#relativeObject



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