123456789_123456789_123456789_123456789_123456789_

Class: IRB::InputMethod

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
Inherits: Object
Defined in: lib/irb/input-method.rb

Class Method Summary

Instance Attribute Summary

  • #file_name readonly

    The file name of this input method, usually given during initialization.

  • #prompt rw

    The irb prompt associated with this input method.

  • #readable_after_eof? ⇒ Boolean readonly

    Whether this input method is still readable when there is no more data to read.

Instance Method Summary

Constructor Details

.new(file = STDIN_FILE_NAME) ⇒ InputMethod

Creates a new input method object

[ GitHub ]

  
# File 'lib/irb/input-method.rb', line 23

def initialize(file = STDIN_FILE_NAME)
  @file_name = file
end

Instance Attribute Details

#file_name (readonly)

The file name of this input method, usually given during initialization.

[ GitHub ]

  
# File 'lib/irb/input-method.rb', line 27

attr_reader :file_name

#prompt (rw)

The irb prompt associated with this input method

[ GitHub ]

  
# File 'lib/irb/input-method.rb', line 30

attr_accessor :prompt

#readable_after_eof?Boolean (readonly)

Whether this input method is still readable when there is no more data to read.

See IO#eof for more information.

[ GitHub ]

  
# File 'lib/irb/input-method.rb', line 52

def readable_after_eof?
  false
end

Instance Method Details

#gets

Reads the next line from this input method.

See IO#gets for more information.

[ GitHub ]

  
# File 'lib/irb/input-method.rb', line 35

def gets
  fail NotImplementedError, "gets"
end

#inspect

For debug message

[ GitHub ]

  
# File 'lib/irb/input-method.rb', line 57

def inspect
  'Abstract InputMethod'
end

#winsize

[ GitHub ]

  
# File 'lib/irb/input-method.rb', line 40

def winsize
  if instance_variable_defined?(:@stdout)
    @stdout.winsize
  else
    [24, 80]
  end
end