Class: A4Tools::PipeBuffer
- Inherits:
-
Object
- Object
- A4Tools::PipeBuffer
- Defined in:
- lib/net_shell/io.rb
Instance Attribute Summary collapse
-
#buffer ⇒ Object
readonly
Returns the value of attribute buffer.
-
#color ⇒ Object
Returns the value of attribute color.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize ⇒ PipeBuffer
constructor
A new instance of PipeBuffer.
- #print(s = "") ⇒ Object
- #printf(s, *a) ⇒ Object
- #puts(s) ⇒ Object
- #read ⇒ Object
- #read_all ⇒ Object
- #write(s) ⇒ Object
Constructor Details
#initialize ⇒ PipeBuffer
Returns a new instance of PipeBuffer.
36 37 38 |
# File 'lib/net_shell/io.rb', line 36 def initialize @buffer = "" end |
Instance Attribute Details
#buffer ⇒ Object (readonly)
Returns the value of attribute buffer.
34 35 36 |
# File 'lib/net_shell/io.rb', line 34 def buffer @buffer end |
#color ⇒ Object
Returns the value of attribute color.
33 34 35 |
# File 'lib/net_shell/io.rb', line 33 def color @color end |
Instance Method Details
#close ⇒ Object
68 69 |
# File 'lib/net_shell/io.rb', line 68 def close end |
#print(s = "") ⇒ Object
64 65 66 |
# File 'lib/net_shell/io.rb', line 64 def print(s="") write(s.to_s) end |
#printf(s, *a) ⇒ Object
60 61 62 |
# File 'lib/net_shell/io.rb', line 60 def printf(s, *a) write(sprintf(s.to_s, *a)) end |
#puts(s) ⇒ Object
52 53 54 55 56 57 58 |
# File 'lib/net_shell/io.rb', line 52 def puts(s) if s.is_a? Array then s.each { |e| puts e.to_s } else write(s.to_s+"\n") end end |
#read ⇒ Object
40 41 42 |
# File 'lib/net_shell/io.rb', line 40 def read @color ? @buffer : @buffer.unstyle end |
#read_all ⇒ Object
44 45 46 |
# File 'lib/net_shell/io.rb', line 44 def read_all @color ? @buffer : @buffer.unstyle end |
#write(s) ⇒ Object
48 49 50 |
# File 'lib/net_shell/io.rb', line 48 def write(s) @buffer += s end |