method

assert_ruby_file_exists

Importance_0
v4.2.9 - Show latest stable - 0 notes - Class: Profiler
assert_ruby_file_exists(path) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File tools/profile, line 70
    def assert_ruby_file_exists(path)
      fail Error.new("No such file") unless File.exist?(path)
      fail Error.new("#{path} is a directory") if File.directory?(path)
      ruby_extension = File.extname(path) == '.rb'
      ruby_executable = File.open(path, 'rb') {|f| f.readline } =~ [/\A#!.*ruby/]
      fail Error.new("Not a ruby file") unless ruby_extension or ruby_executable
    end
Register or log in to add new notes.