class IRB::Notifier::CompositeNotifier
#def_notifier.
object you create, sibling notifiers can be initialized with
create a new composite notifier. Using the first composite notifier
The Notifier class provides a class-method Notifier.def_notifier to
the appropriate level for output.
This class will allow you to generate other notifiers, and assign them
intent of representing a leveled notification system for irb.
A class that can be used to create a group of notifier objects with the
def def_notifier(level, prefix = "")
be used as the index of the #notifiers Array.
The given +prefix+ will be assigned to the notifier, and +level+ will
Creates a new LeveledNotifier in the composite #notifiers group.
def def_notifier(level, prefix = "") notifier = LeveledNotifier.new(self, level, prefix) @notifiers[level] = notifier notifier end
def initialize(prefix, base_notifier)
Create a new composite notifier object with the given +prefix+, and
def initialize(prefix, base_notifier) super @notifiers = [D_NOMSG] @level_notifier = D_NOMSG end
def level_notifier=(value)
found in the existing #notifiers Array, or an instance of
An ErrUnrecognizedLevel exception is raised if the given +value+ is not
ErrUndefinedNotifier exception is raised.
If no notifier exists at the index +value+ in the #notifiers Array, an
index +value+ in the #notifiers Array.
When an Integer is given, #level_notifier is set to the notifier at the
#level_notifier is set to the given object.
When the given +value+ is an instance of AbstractNotifier,
Sets the leveled notifier for this object.
def level_notifier=(value) case value when AbstractNotifier @level_notifier = value when Integer l = @notifiers[value] raise ErrUndefinedNotifier, value unless l @level_notifier = l else raise ErrUnrecognizedLevel, value unless l end end