Module: Vedeu::Presentation::Position Private

Overview

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

Provide position functionality to the including model.

Instance Method Summary collapse

Instance Method Details

#positionNilClass|Vedeu::Geometries::Position

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.

Gets the position.

Returns:



16
17
18
# File 'lib/vedeu/presentation/position.rb', line 16

def position
  Vedeu::Geometries::Position.coerce(@position)
end

#position=(value) ⇒ NilClass|Vedeu::Geometries::Position

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.

Sets the position.

Parameters:

Returns:



25
26
27
# File 'lib/vedeu/presentation/position.rb', line 25

def position=(value)
  @position = Vedeu::Geometries::Position.coerce(value)
end

#position?Boolean

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 a boolean indicating the position attribute of the including model is set.

Returns:



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

def position?
  position.is_a?(Vedeu::Geometries::Position)
end

#render_position(&block) ⇒ String (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.

Parameters:

  • block (Proc)

Returns:

  • (String)


57
58
59
60
61
# File 'lib/vedeu/presentation/position.rb', line 57

def render_position(&block)
  return position.to_s { yield } if position?

  yield
end

#xFixnum|NilClass

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 the x coordinate for the model when the position attribute of the including model is set.

Returns:

  • (Fixnum|NilClass)


41
42
43
# File 'lib/vedeu/presentation/position.rb', line 41

def x
  position.x if position?
end

#yFixnum|NilClass

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 the y coordinate for the model when the position attribute of the including model is set.

Returns:

  • (Fixnum|NilClass)


49
50
51
# File 'lib/vedeu/presentation/position.rb', line 49

def y
  position.y if position?
end