module Sprockets::PathUtils

Internal: File and path related utilities. Mixed into Environment.

Probably would be called FileUtils, but that causes namespace annoyances when code actually wants to reference ::FileUtils.

Public Instance Methods

file?(path) click to toggle source

Public: Like `File.file?`.

path - String file path.

Returns true path exists and is a file.

# File lib/volt/server/template_handlers/sprockets_component_handler.rb, line 81
def file?(path)
  if stat = self.stat(path)
    stat.file?
  elsif path =~ /^#{Volt.root}\/app\/components\/[^\/]+[.]rb$/
    # Matches a component
    return true
  else
    false
  end
end