A class that can be used to create a group of notifier objects with the intent of representing a leveled notification system for irb.

This class will allow you to generate other notifiers, and assign them the appropriate level for output.

The Notifier class provides a class-method IRB::Notifier.def_notifier to create a new composite notifier. Using the first composite notifier object you create, sibling notifiers can be initialized with def_notifier.

[R] level

Returns the leveled notifier for this object

[R] level_notifier

Returns the leveled notifier for this object

[R] notifiers

List of notifiers in the group

Class Public methods
new(prefix, base_notifier)

Create a new composite notifier object with the given prefix, and base_notifier to use for output.

# File lib/irb/notifier.rb, line 119
def initialize(prefix, base_notifier)

  @notifiers = [D_NOMSG]
  @level_notifier = D_NOMSG
Instance Public methods
def_notifier(level, prefix = "")

Creates a new LeveledNotifier in the composite notifiers group.

The given prefix will be assigned to the notifier, and level will be used as the index of the notifiers Array.

This method returns the newly created instance.

# File lib/irb/notifier.rb, line 135
def def_notifier(level, prefix = "")
  notifier = LeveledNotifier.new(self, level, prefix)
  @notifiers[level] = notifier
Alias for: level_notifier=

Sets the leveled notifier for this object.

When the given value is an instance of AbstractNotifier, level_notifier is set to the given object.

When an Integer is given, level_notifier is set to the notifier at the index value in the notifiers Array.

If no notifier exists at the index value in the notifiers Array, an ErrUndefinedNotifier exception is raised.

An ErrUnrecognizedLevel exception is raised if the given value is not found in the existing notifiers Array, or an instance of AbstractNotifier

Also aliased as: level=
# File lib/irb/notifier.rb, line 159
def level_notifier=(value)
  case value
  when AbstractNotifier
    @level_notifier = value
  when Integer
    l = @notifiers[value]
    Notifier.Raise ErrUndefinedNotifier, value unless l
    @level_notifier = l
    Notifier.Raise ErrUnrecognizedLevel, value unless l