Method: CommentExtractor::File.shebang

Defined in:
lib/comment_extractor/file.rb

.shebang(path) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/comment_extractor/file.rb', line 9

def self.shebang(path)
  if File.extname(path).empty?
    line = File.open(path) { |f| f.gets }
    if /\A#!\s*(?<shebang_path>.+)/ =~ line
      shebang_path
    end
  end
end