Class: Pry::Output
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(_pry_) ⇒ Output
Returns a new instance of Output.
4
5
6
7
|
# File 'lib/pry/output.rb', line 4
def initialize(_pry_)
@_pry_ = _pry_
@boxed_io = _pry_.config.output
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
34
35
36
|
# File 'lib/pry/output.rb', line 34
def method_missing(name, *args, &block)
@boxed_io.__send__(name, *args, &block)
end
|
Instance Attribute Details
Returns the value of attribute pry.
2
3
4
|
# File 'lib/pry/output.rb', line 2
def _pry_
@_pry_
end
|
Instance Method Details
#decolorize_maybe(str) ⇒ Object
42
43
44
45
46
47
48
|
# File 'lib/pry/output.rb', line 42
def decolorize_maybe(str)
if _pry_.config.color
str
else
Pry::Helpers::Text.strip_color str
end
end
|
#print(*objs) ⇒ Object
Also known as:
<<, write
21
22
23
24
25
26
|
# File 'lib/pry/output.rb', line 21
def print(*objs)
objs.each do |obj|
@boxed_io.print decolorize_maybe(obj.to_s)
end
nil
end
|
#puts(*objs) ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/pry/output.rb', line 9
def puts(*objs)
return print "\n" if objs.empty?
objs.each do |obj|
if ary = Array.try_convert(obj)
puts(*ary)
else
print "#{obj.to_s.chomp}\n"
end
end
nil
end
|
#respond_to_missing?(m, include_all = false) ⇒ Boolean
38
39
40
|
# File 'lib/pry/output.rb', line 38
def respond_to_missing?(m, include_all=false)
@boxed_io.respond_to?(m, include_all)
end
|
#tty? ⇒ Boolean
30
31
32
|
# File 'lib/pry/output.rb', line 30
def tty?
@boxed_io.respond_to?(:tty?) and @boxed_io.tty?
end
|