Class: Rink::InputMethod::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/rink/input_method/base.rb

Direct Known Subclasses

File, IO

Constant Summary collapse

STDIN_FILE_NAME =
"(line)"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(prompt = " > ", file = STDIN_FILE_NAME) ⇒ Base

Returns a new instance of Base.



6
7
8
9
10
# File 'lib/rink/input_method/base.rb', line 6

def initialize(prompt = " > ", file = STDIN_FILE_NAME)
  @prompt = prompt
  @output = nil
  @filename = file
end

Instance Attribute Details

#filenameObject (readonly)

Returns the value of attribute filename.



12
13
14
# File 'lib/rink/input_method/base.rb', line 12

def filename
  @filename
end

#outputObject

Returns the value of attribute output.



14
15
16
# File 'lib/rink/input_method/base.rb', line 14

def output
  @output
end

#promptObject

Returns the value of attribute prompt.



13
14
15
# File 'lib/rink/input_method/base.rb', line 13

def prompt
  @prompt
end

Instance Method Details

#encodingObject



16
17
18
# File 'lib/rink/input_method/base.rb', line 16

def encoding
  input.external_encoding
end

#getsObject

Raises:

  • (NotImplementedError)


36
37
38
# File 'lib/rink/input_method/base.rb', line 36

def gets
  raise NotImplementedError, "gets"
end

#inputObject

Raises:

  • (NotImplementedError)


20
21
22
# File 'lib/rink/input_method/base.rb', line 20

def input
  raise NotImplementedError, "input"
end


24
25
26
# File 'lib/rink/input_method/base.rb', line 24

def print(*args)
  @output.print(*args) if @output
end

#puts(*args) ⇒ Object



28
29
30
# File 'lib/rink/input_method/base.rb', line 28

def puts(*args)
  @output.puts(*args) if @output
end

#readable_after_eof?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/rink/input_method/base.rb', line 40

def readable_after_eof?
  false
end

#write(*args) ⇒ Object



32
33
34
# File 'lib/rink/input_method/base.rb', line 32

def write(*args)
  @output.write(*args) if @output
end