This file is indexed.

/usr/lib/ruby/1.8/innate/helper/render.rb is in libinnate-ruby1.8 2010.07-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
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
module Innate
  module Helper
    module Render
      # Enables you to simply call:
      #
      # @example of added functionality
      #   YourController.render_partial(:foo, :x => 42)
      def self.included(into)
        into.extend(self)
      end

      # Renders the full action in the way a real request would.
      #
      # Please be aware that, if this is the first request from a client, you
      # will not have access to the session in the action being rendered, as no
      # actual session has been put into place yet.
      #
      # It should work as expected on any subsequent requests.
      #
      # As usual, patches welcome.
      #
      # @example usage
      #
      #   render_full('/blog/article/1')
      #   render_full('/blog/article/1', :lang => :de)
      #
      # Please note that you have to give the full path in the same way you'd
      # do in a direct request with curl or a browser.
      #
      # @api external
      # @see Mock.session
      # @author manveru
      def render_full(path, query = {})
        uri = URI(path.to_s)
        uri.query = Rack::Utils.build_query(query)

        if cookie = request.env['HTTP_COOKIE']
          Mock.session do |mock|
            mock.cookie = cookie
            return mock.get(uri.to_s).body
          end
        else
          Mock.get(uri.to_s).body
        end
      end

      # Renders an action without any layout.
      # You can further tweak the action to be rendered by passing a block.
      #
      # @example usage
      #
      #   render_partial(:index)
      #   render_partial(:index, :title => :foo)
      #
      # Please note that you only have to supply the action name, if your
      # action requires arguments then you have to pass a name suitable for
      # that.
      #
      # @example usage with action that requires arguments
      #
      #   # requires two arguments
      #   def foo(a, b)
      #   end
      #
      #   # pass two suitable arguments
      #   render_partial('foo/1/2')
      #
      # @api external
      # @see render_custom
      # @author manveru
      def render_partial(action_name, variables = {})
        render_custom(action_name, variables) do |action|
          action.layout = nil
          yield(action) if block_given?
        end
      end

      # Renders an action view and does not execute any methods.
      # The rendered view will not be wrapped in a layout and instead 
      # will use the layout of the current action.
      # You can further tweak the action to be rendered by passing a block.
      #
      # @example usage
      #
      #   render_view(:index)
      #   render_view(:index, :title => :foo)
      #
      # @api external
      # @see render_custom
      # @author manveru
      def render_view(action_name, variables = {})
        render_custom(action_name, variables) do |action|
          action.layout = nil
          action.method = nil
          yield(action) if block_given?
        end
      end

      # Use the given file as a template and render it in the same scope as
      # the current action.
      # The +filename+ may be an absolute path or relative to the process
      # working directory.
      #
      # @example usage
      #
      #   path = '/home/manveru/example/app/todo/view/index.xhtml'
      #   render_file(path)
      #   render_file(path, :title => :foo)
      #
      # Ramaze will emit a warning if you try to render an Action without a
      # method or view template, but will still try to render it.
      # The usual {Action#valid?} doesn't apply here, as sometimes you just
      # cannot have a method associated with a template.
      #
      # @api external
      # @see render_custom
      # @author manveru
      def render_file(filename, variables = {})
        action = Action.create(:view => filename)
        action.sync_variables(self.action)

        action.node      = self.class
        action.engine    = self.action.engine
        action.instance  = action.node.new
        action.variables.merge!(variables)

        yield(action) if block_given?

        valid_action = action.view || action.method
        Log.warn("Empty action: %p" % [action]) unless valid_action
        action.render
      end

      # @api internal
      # @author manveru
      def render_custom(action_name, variables = {})
        unless action = resolve(action_name.to_s)
          raise(ArgumentError, "No Action %p on #{self}" % [action_name])
        end

        action.sync_variables(self.action)
        action.instance = action.node.new
        action.variables = action.variables.merge(variables)

        yield(action) if block_given?

        valid_action = action.view || action.method
        Log.warn("Empty action: %p" % [action]) unless valid_action
        action.render
      end
    end
  end
end