This file is indexed.

/usr/lib/ruby/vendor_ruby/rugments/text_analyzer.rb is in ruby-rugments 1.0.0~beta8-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
module Rugments
  class TextAnalyzer < String
    # Find a shebang.  Returns nil if no shebang is present.
    def shebang
      return @shebang if instance_variable_defined? :@shebang

      self =~ /\A\s*#!(.*)$/
      @shebang = $1
    end

    # Check if the given shebang is present.
    #
    # This normalizes things so that `text.shebang?('bash')` will detect
    # `#!/bash`, '#!/bin/bash', '#!/usr/bin/env bash', and '#!/bin/bash -x'
    def shebang?(match)
      match = /\b#{match}(\s|$)/
      match === shebang
    end

    # Return the contents of the doctype tag if present, nil otherwise.
    def doctype
      return @doctype if instance_variable_defined? :@doctype

      self =~ %r(\A\s*
        (?:<\?.*?\?>\s*)? # possible <?xml...?> tag
        <!DOCTYPE\s+(.+?)>
      )xm
      @doctype = $1
    end

    # Check if the doctype matches a given regexp or string
    def doctype?(type=//)
      type === doctype
    end

    # Return true if the result of lexing with the given lexer contains no
    # error tokens.
    def lexes_cleanly?(lexer)
      lexer.lex(self) do |(tok, _)|
        return false if tok.name == 'Error'
      end

      true
    end
  end
end