Class: Vedeu::Position

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

Instance Method Summary collapse

Constructor Details

#initialize(y = 1, x = 1) ⇒ Position

Parameters:



7
8
9
# File 'lib/vedeu/support/position.rb', line 7

def initialize(y = 1, x = 1)
  @y, @x = y, x
end

Instance Method Details

#sequenceString (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)


27
28
29
# File 'lib/vedeu/support/position.rb', line 27

def sequence
  ["\e[", y, ';', x, 'H'].join
end

#to_s(&block) ⇒ String

Parameters:

  • block (Proc)

Returns:

  • (String)


13
14
15
16
17
18
19
20
21
# File 'lib/vedeu/support/position.rb', line 13

def to_s(&block)
  if block_given?
    [ sequence, yield, sequence ].join

  else
    sequence

  end
end

#xFixnum (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:



39
40
41
# File 'lib/vedeu/support/position.rb', line 39

def x
  (@x == 0 || @x == nil) ? 1 : @x
end

#yFixnum (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:



33
34
35
# File 'lib/vedeu/support/position.rb', line 33

def y
  (@y == 0 || @y == nil) ? 1 : @y
end