Sha256: f72216694db7fc251a2a5577a59448c42291a5a96f754be3cd64cf06edd89461

Contents?: true

Size: 835 Bytes

Versions: 2

Compression:

Stored size: 835 Bytes

Contents

module Rink
  module InputMethod
    class Base
      STDIN_FILE_NAME = "(line)"
  
      def initialize(prompt = " > ", file = STDIN_FILE_NAME)
        @prompt = prompt
        @output = nil
        @filename = file
      end
  
      attr_reader :filename
      attr_accessor :prompt
      attr_accessor :output
      
      def encoding
        input.external_encoding
      end

      def input
        raise NotImplementedError, "input"
      end
      
      def print(*args)
        @output.print(*args) if @output
      end
      
      def puts(*args)
        @output.puts(*args) if @output
      end
      
      def write(*args)
        @output.write(*args) if @output
      end
  
      def gets
        raise NotImplementedError, "gets"
      end
  
      def readable_after_eof?
        false
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rink-1.0.2 lib/rink/input_method/base.rb
rink-1.0.1 lib/rink/input_method/base.rb