Class: Virb::Pry::Fifo

Inherits:
Object
  • Object
show all
Defined in:
lib/virb/pry.rb

Instance Method Summary collapse

Constructor Details

#initializeFifo

Returns a new instance of Fifo.



4
5
6
# File 'lib/virb/pry.rb', line 4

def initialize
  reinit_fifo
end

Instance Method Details

#readline(current_prompt) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/virb/pry.rb', line 19

def readline(current_prompt)
  $stdout.print current_prompt
  if @io.eof?
    @io.close
    reinit_fifo
  end
  x = @io.gets
  $stdout.print x
  x
end

#reinit_fifoObject



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/virb/pry.rb', line 7

def reinit_fifo

  `rm -rf .virb`
  `mkdir -p .virb`
  unless File.exist?('.virb/fifo')
    `mkfifo .virb/fifo`
  end
  `touch .virb/session`

  fd = IO.sysopen(".virb/fifo")
  @io = IO.new(fd, 'r')
end

#rewindObject



29
30
# File 'lib/virb/pry.rb', line 29

def rewind
end