"Fossies" - the Fresh Open Source Software Archive

Member "file-5.35/magic/Magdir/ruby" (14 Aug 2017, 1808 Bytes) of package /linux/misc/file-5.35.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "ruby": 5.31_vs_5.32.

    1 
    2 #------------------------------------------------------------------------------
    3 # $File: ruby,v 1.7 2017/08/14 13:39:18 christos Exp $
    4 # ruby:  file(1) magic for Ruby scripting language
    5 # URL:  http://www.ruby-lang.org/
    6 # From: Reuben Thomas <rrt@sc3d.org>
    7 
    8 # Ruby scripts
    9 0	search/1/w	#!\ /usr/bin/ruby				Ruby script text executable
   10 !:strength + 15
   11 !:mime text/x-ruby
   12 0	search/1/w	#!\ /usr/local/bin/ruby	Ruby script text executable
   13 !:strength + 15
   14 !:mime text/x-ruby
   15 0	search/1	#!/usr/bin/env\ ruby				Ruby script text executable
   16 !:strength + 15
   17 !:mime text/x-ruby
   18 0	search/1	#!\ /usr/bin/env\ ruby			Ruby script text executable
   19 !:strength + 15
   20 !:mime text/x-ruby
   21 
   22 # What looks like ruby, but does not have a shebang
   23 # (modules and such)
   24 # From: Lubomir Rintel <lkundrak@v3.sk>
   25 0	regex		\^[[:space:]]*require[[:space:]]'[A-Za-z_/]+'
   26 >0	regex		def\ [a-z]|\ do$
   27 >>&0	regex		\^[[:space:]]*end([[:space:]]+[;#].*)?$		Ruby script text
   28 !:strength + 30
   29 !:mime	text/x-ruby
   30 0	regex		\^[[:space:]]*(class|module)[[:space:]][A-Z]
   31 >0	regex		(modul|includ)e\ [A-Z]|def\ [a-z]
   32 >>&0	regex		\^[[:space:]]*end([[:space:]]+[;#].*)?$		Ruby script text
   33 !:strength + 30
   34 !:mime	text/x-ruby
   35 # Classes with no modules or defs, beats simple ASCII
   36 0	regex		\^[[:space:]]*(class|module)[[:space:]][A-Z]
   37 >&0	regex	\^[[:space:]]*end([[:space:]]+[;#if].*)?$		Ruby script text
   38 !:strength + 10
   39 !:mime	text/x-ruby
   40 # Looks for function definition to balance python magic
   41 # def name (args)
   42 # end
   43 0	regex		\^[[:space:]]*def\ [a-z]|def\ [[:alpha:]]+::[a-z]
   44 >&0	regex		\^[[:space:]]*end([[:space:]]+[;#].*)?$		Ruby script text
   45 !:strength + 10
   46 !:mime	text/x-ruby
   47 
   48 0	regex		\^[[:space:]]*require[[:space:]]'[A-Za-z_/]+'	Ruby script text
   49 !:mime	text/x-ruby
   50 0 regex 	\^[[:space:]]*include\ ([A-Z]+[a-z]*(::))+	Ruby script text
   51 !:mime	text/x-ruby