Module: Sprockets::PathUtils

Extended by:
PathUtils
Included in:
PathUtils
Defined in:
lib/volt/server/template_handlers/sprockets_component_handler.rb

Overview

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.

Instance Method Summary collapse

Instance Method Details

#file?(path) ⇒ Boolean

Public: Like ‘File.file?`.

path - String file path.

Returns true path exists and is a file.

Returns:



81
82
83
84
85
86
87
88
89
90
# 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