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_error(message) ⇒ Object
- #print_frame ⇒ Object
- #print_line(str) ⇒ Object (also: #puts)
Constructor Details
#initialize(input, output) ⇒ Interface
Returns a new instance of Interface.
3 4 5 6 |
# File 'lib/3llo/interface.rb', line 3 def initialize(input, output) @input = input @output = output end |
Instance Attribute Details
#input ⇒ Object (readonly)
Returns the value of attribute input.
30 31 32 |
# File 'lib/3llo/interface.rb', line 30 def input @input end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
30 31 32 |
# File 'lib/3llo/interface.rb', line 30 def output @output end |
Instance Method Details
#print(str) ⇒ Object
21 22 23 |
# File 'lib/3llo/interface.rb', line 21 def print(str) output.print(str) end |
#print_error(message) ⇒ Object
25 26 27 28 |
# File 'lib/3llo/interface.rb', line 25 def print_error() print_line(Utils.paint(, "red")) print_line("") end |
#print_frame ⇒ Object
8 9 10 11 12 13 |
# File 'lib/3llo/interface.rb', line 8 def print_frame print_line("") data = yield print_line("") data end |
#print_line(str) ⇒ Object Also known as: puts
15 16 17 |
# File 'lib/3llo/interface.rb', line 15 def print_line(str) output.puts(str) end |