Class: Tr3llo::Interface
- Inherits:
-
Object
- Object
- Tr3llo::Interface
- Defined in:
- lib/3llo/interface.rb
Instance Attribute Summary collapse
-
#input ⇒ Object
readonly
Returns the value of attribute input.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
-
#initialize(input, output) ⇒ Interface
constructor
A new instance of Interface.
- #print(str) ⇒ Object
- #print_frame ⇒ Object
- #print_line(str) ⇒ Object (also: #puts)
- #prompt(message) ⇒ Object
Constructor Details
#initialize(input, output) ⇒ Interface
Returns a new instance of Interface.
3 4 5 |
# File 'lib/3llo/interface.rb', line 3 def initialize(input, output) @input, @output = input, output end |
Instance Attribute Details
#input ⇒ Object (readonly)
Returns the value of attribute input.
28 29 30 |
# File 'lib/3llo/interface.rb', line 28 def input @input end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
28 29 30 |
# File 'lib/3llo/interface.rb', line 28 def output @output end |
Instance Method Details
#print(str) ⇒ Object
19 20 21 |
# File 'lib/3llo/interface.rb', line 19 def print(str) output.print(str) end |
#print_frame ⇒ Object
7 8 9 10 11 12 |
# File 'lib/3llo/interface.rb', line 7 def print_frame print_line("") data = yield print_line("") data end |
#print_line(str) ⇒ Object Also known as: puts
14 15 16 |
# File 'lib/3llo/interface.rb', line 14 def print_line(str) output.puts(str) end |
#prompt(message) ⇒ Object
23 24 25 26 |
# File 'lib/3llo/interface.rb', line 23 def prompt() print("Enter list ID to be moved to: ") input.gets.chomp end |