/usr/lib/ruby/vendor_ruby/merb-core/dispatch/router/cached_proc.rb is in ruby-merb-core 1.1.3+dfsg-2.
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 | module Merb
class Router
# Cache procs for future reference in eval statement
# :api: private
class CachedProc
@@index = 0
@@list = []
# :api: private
attr_accessor :cache, :index
# ==== Parameters
# cache<Proc>:: The block of code to cache.
#
# :api: private
def initialize(cache)
@cache, @index = cache, CachedProc.register(self)
end
# ==== Returns
# String:: The CachedProc object in a format embeddable within a string.
#
# :api: private
def to_s
"CachedProc[#{@index}].cache"
end
class << self
# ==== Parameters
# cached_code<CachedProc>:: The cached code to register.
#
# ==== Returns
# Fixnum:: The index of the newly registered CachedProc.
#
# :api: private
def register(cached_code)
CachedProc[@@index] = cached_code
@@index += 1
@@index - 1
end
# Sets the cached code for a specific index.
#
# ==== Parameters
# index<Fixnum>:: The index of the cached code to set.
# code<CachedProc>:: The cached code to set.
#
# :api: private
def []=(index, code) @@list[index] = code end
# ==== Parameters
# index<Fixnum>:: The index of the cached code to retrieve.
#
# ==== Returns
# CachedProc:: The cached code at index.
#
# :api: private
def [](index) @@list[index] end
end
end # CachedProc
end
end
|