This file is indexed.

/usr/lib/ruby/vendor_ruby/simple_navigation/adapters/sinatra.rb is in ruby-simple-navigation 3.11.0-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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
require 'cgi'

module SimpleNavigation
  module Adapters
    class Sinatra < Base

      def self.register
        SimpleNavigation.set_env(sinatra_root, sinatra_environment)
        ::Sinatra::Application.send(:helpers, SimpleNavigation::Helpers)
      end

      def initialize(context)
        @context = context
        @request = context.request
      end

      def context_for_eval
        raise 'no context set for evaluation the config file' unless context
        context
      end

      def request_uri
        request.fullpath
      end

      def request_path
        request.path
      end

      def current_page?(url)
        url_string = CGI.unescape(url)
        if url_string.index("?")
          uri = request_uri
        else
          uri = request_uri.split('?').first
        end
        uri = CGI.unescape(uri)
        if url_string =~ /^\w+:\/\//
          url_string == "#{request.scheme}://#{request.host_with_port}#{uri}"
        else
          url_string == uri
        end
      end

      def link_to(name, url, options={})
        "<a href='#{url}'#{to_attributes(options)}>#{name}</a>"
      end

      def content_tag(type, content, options={})
        "<#{type}#{to_attributes(options)}>#{content}</#{type}>"
      end

      protected

      def self.sinatra_root
        ::Sinatra::Application.root
      end

      def self.sinatra_environment
        ::Sinatra::Application.environment
      end

      def to_attributes(options)
        options.map {|k, v| v.nil? ? '' : " #{k}='#{v}'"}.join
      end

    end
  end
end