This file is indexed.

/usr/lib/ruby/1.8/irb/notifier.rb is in libruby1.8 1.8.7.352-2ubuntu1.6.

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
#
#   notifier.rb - output methods used by irb 
#   	$Release Version: 0.9.5$
#   	$Revision: 16857 $
#   	$Date: 2008-06-06 17:05:24 +0900 (Fri, 06 Jun 2008) $
#   	by Keiju ISHITSUKA(keiju@ruby-lang.org)
#
# --
#
#   
#

require "e2mmap"
require "irb/output-method"

module IRB
  module Notifier
    extend Exception2MessageMapper
    def_exception :ErrUndefinedNotifier, 
      "undefined notifier level: %d is specified"
    def_exception :ErrUnrecognizedLevel, 
      "unrecognized notifier level: %s is specified"

    def def_notifier(prefix = "", output_method = StdioOutputMethod.new)
      CompositeNotifier.new(prefix, output_method)
    end
    module_function :def_notifier
  
    class AbstructNotifier
      def initialize(prefix, base_notifier)
	@prefix = prefix
	@base_notifier = base_notifier
      end

      attr_reader :prefix

      def notify?
	true
      end

      def print(*opts)
	@base_notifier.print prefix, *opts if notify?
      end

      def printn(*opts)
	@base_notifier.printn prefix, *opts if notify?
      end

      def printf(format, *opts)
	@base_notifier.printf(prefix + format, *opts) if notify?
      end

      def puts(*objs)
	if notify?
	  @base_notifier.puts(*objs.collect{|obj| prefix + obj.to_s})
	end
      end

      def pp(*objs)
	if notify?
	  @base_notifier.ppx @prefix, *objs
	end
      end

      def ppx(prefix, *objs)
	if notify?
	  @base_notifier.ppx @prefix+prefix, *objs
	end
      end

      def exec_if
	yield(@base_notifier) if notify?
      end
    end

    class CompositeNotifier<AbstructNotifier
      def initialize(prefix, base_notifier)
	super

	@notifiers = [D_NOMSG]
	@level_notifier = D_NOMSG
      end

      attr_reader :notifiers

      def def_notifier(level, prefix = "")
	notifier = LeveledNotifier.new(self, level, prefix)
	@notifiers[level] = notifier
	notifier
      end

      attr_reader :level_notifier
      alias level level_notifier

      def level_notifier=(value)
	case value
	when AbstructNotifier
	  @level_notifier = value
	when Integer
	  l = @notifiers[value]
	  Notifier.Raise ErrUndefinedNotifer, value unless l
	  @level_notifier = l
	else
	  Notifier.Raise ErrUnrecognizedLevel, value unless l
	end
      end

      alias level= level_notifier=
    end

    class LeveledNotifier<AbstructNotifier
      include Comparable

      def initialize(base, level, prefix)
	super(prefix, base)
	
	@level = level
      end

      attr_reader :level

      def <=>(other)
	@level <=> other.level
      end
      
      def notify?
	@base_notifier.level >= self
      end
    end

    class NoMsgNotifier<LeveledNotifier
      def initialize
	@base_notifier = nil
	@level = 0
	@prefix = ""
      end

      def notify?
	false
      end
    end

    D_NOMSG = NoMsgNotifier.new
  end
end