Class: Tr3llo::Interface

Inherits:
Object
  • Object
show all
Defined in:
lib/3llo/interface.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#inputObject (readonly)

Returns the value of attribute input.



30
31
32
# File 'lib/3llo/interface.rb', line 30

def input
  @input
end

#outputObject (readonly)

Returns the value of attribute output.



30
31
32
# File 'lib/3llo/interface.rb', line 30

def output
  @output
end

Instance Method Details



21
22
23
# File 'lib/3llo/interface.rb', line 21

def print(str)
  output.print(str)
end


25
26
27
28
# File 'lib/3llo/interface.rb', line 25

def print_error(message)
  print_line(Utils.paint(message, "red"))
  print_line("")
end


8
9
10
11
12
13
# File 'lib/3llo/interface.rb', line 8

def print_frame
  print_line("")
  data = yield
  print_line("")
  data
end


15
16
17
# File 'lib/3llo/interface.rb', line 15

def print_line(str)
  output.puts(str)
end