Class: IRB::Notifier::AbstractNotifier
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(prefix, base_notifier) ⇒ AbstractNotifier
Returns a new instance of AbstractNotifier.
29
30
31
32
|
# File 'lib/irb/notifier.rb', line 29
def initialize(prefix, base_notifier)
@prefix = prefix
@base_notifier = base_notifier
end
|
Instance Attribute Details
Returns the value of attribute prefix
34
35
36
|
# File 'lib/irb/notifier.rb', line 34
def prefix
@prefix
end
|
Instance Method Details
#exec_if {|@base_notifier| ... } ⇒ Object
70
71
72
|
# File 'lib/irb/notifier.rb', line 70
def exec_if
yield(@base_notifier) if notify?
end
|
#notify? ⇒ Boolean
36
37
38
|
# File 'lib/irb/notifier.rb', line 36
def notify?
true
end
|
#pp(*objs) ⇒ Object
58
59
60
61
62
|
# File 'lib/irb/notifier.rb', line 58
def pp(*objs)
if notify?
@base_notifier.ppx @prefix, *objs
end
end
|
#ppx(prefix, *objs) ⇒ Object
64
65
66
67
68
|
# File 'lib/irb/notifier.rb', line 64
def ppx(prefix, *objs)
if notify?
@base_notifier.ppx @prefix+prefix, *objs
end
end
|
#print(*opts) ⇒ Object
40
41
42
|
# File 'lib/irb/notifier.rb', line 40
def print(*opts)
@base_notifier.print prefix, *opts if notify?
end
|
#printf(format, *opts) ⇒ Object
48
49
50
|
# File 'lib/irb/notifier.rb', line 48
def printf(format, *opts)
@base_notifier.printf(prefix + format, *opts) if notify?
end
|
#printn(*opts) ⇒ Object
44
45
46
|
# File 'lib/irb/notifier.rb', line 44
def printn(*opts)
@base_notifier.printn prefix, *opts if notify?
end
|
#puts(*objs) ⇒ Object
52
53
54
55
56
|
# File 'lib/irb/notifier.rb', line 52
def puts(*objs)
if notify?
@base_notifier.puts(*objs.collect{|obj| prefix + obj.to_s})
end
end
|