Class: Vedeu::Clear

Inherits:
Object
  • Object
show all
Defined in:
lib/vedeu/support/clear.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(interface) ⇒ Clear

Parameters:



12
13
14
# File 'lib/vedeu/support/clear.rb', line 12

def initialize(interface)
  @interface = interface
end

Instance Attribute Details

#interfaceObject (readonly, private)

Returns the value of attribute interface.



25
26
27
# File 'lib/vedeu/support/clear.rb', line 25

def interface
  @interface
end

Class Method Details

.call(interface) ⇒ String

Parameters:

Returns:

  • (String)


6
7
8
# File 'lib/vedeu/support/clear.rb', line 6

def self.call(interface)
  new(interface).clear
end

Instance Method Details

#clearString

Returns:

  • (String)


17
18
19
20
21
# File 'lib/vedeu/support/clear.rb', line 17

def clear
  rows.inject([colours]) do |line, index|
    line << interface.origin(index) { ' ' * interface.viewport_width }
  end.join
end

#coloursString (private)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String)


29
30
31
# File 'lib/vedeu/support/clear.rb', line 29

def colours
  interface.colour.to_s
end

#rowsEnumerator (private)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Enumerator)


35
36
37
# File 'lib/vedeu/support/clear.rb', line 35

def rows
  interface.viewport_height.times
end