Class: Rink::InputMethod::Base
Constant Summary collapse
- STDIN_FILE_NAME =
"(line)"
Instance Attribute Summary collapse
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#output ⇒ Object
Returns the value of attribute output.
-
#prompt ⇒ Object
Returns the value of attribute prompt.
Instance Method Summary collapse
- #encoding ⇒ Object
- #gets ⇒ Object
-
#initialize(prompt = " > ", file = STDIN_FILE_NAME) ⇒ Base
constructor
A new instance of Base.
- #input ⇒ Object
- #print(*args) ⇒ Object
- #puts(*args) ⇒ Object
- #readable_after_eof? ⇒ Boolean
- #write(*args) ⇒ Object
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
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
12 13 14 |
# File 'lib/rink/input_method/base.rb', line 12 def filename @filename end |
#output ⇒ Object
Returns the value of attribute output.
14 15 16 |
# File 'lib/rink/input_method/base.rb', line 14 def output @output end |
#prompt ⇒ Object
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
#encoding ⇒ Object
16 17 18 |
# File 'lib/rink/input_method/base.rb', line 16 def encoding input.external_encoding end |
#gets ⇒ Object
36 37 38 |
# File 'lib/rink/input_method/base.rb', line 36 def gets raise NotImplementedError, "gets" end |
#input ⇒ Object
20 21 22 |
# File 'lib/rink/input_method/base.rb', line 20 def input raise NotImplementedError, "input" end |
#print(*args) ⇒ Object
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
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 |