Class: A4Tools::PipeBuffer

Inherits:
Object
  • Object
show all
Defined in:
lib/net_shell/io.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePipeBuffer

Returns a new instance of PipeBuffer.



36
37
38
# File 'lib/net_shell/io.rb', line 36

def initialize
  @buffer = ""
end

Instance Attribute Details

#bufferObject (readonly)

Returns the value of attribute buffer.



34
35
36
# File 'lib/net_shell/io.rb', line 34

def buffer
  @buffer
end

#colorObject

Returns the value of attribute color.



33
34
35
# File 'lib/net_shell/io.rb', line 33

def color
  @color
end

Instance Method Details

#closeObject



68
69
# File 'lib/net_shell/io.rb', line 68

def close
end


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

#readObject



40
41
42
# File 'lib/net_shell/io.rb', line 40

def read
  @color ? @buffer : @buffer.unstyle
end

#read_allObject



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