class PathUtils

Public Class Methods

pathWithComponents(components) click to toggle source

Returns a path composed of components, without leading and trailing slashes

# File lib/second_curtain/path_utils.rb, line 4
def self.pathWithComponents(components)
  path = ""

  for component in components do
    path = self.sanitizePathComponent(path + "/" + self.sanitizePathComponent(component))
  end

  return path
end
sanitizePathComponent(component) click to toggle source

Takes a path component and strips leading and trailing slashes

# File lib/second_curtain/path_utils.rb, line 17
def self.sanitizePathComponent(component)
  # Remove leading and trailing slash
  component.gsub(/^\//, "").chomp("/")
end