Class: Vedeu::ContentGeometry

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/vedeu/geometry/content_geometry.rb

Overview

Provides information about the content within an interface or view.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(interface) ⇒ Vedeu::ContentGeometry

Parameters:



22
23
24
# File 'lib/vedeu/geometry/content_geometry.rb', line 22

def initialize(interface)
  @interface = interface
end

Instance Attribute Details

#interfaceObject (readonly, private)

Returns the value of attribute interface.



44
45
46
# File 'lib/vedeu/geometry/content_geometry.rb', line 44

def interface
  @interface
end

Instance Method Details

#columnsFixnum (private)

Returns the character length of the longest line for this interface.

Returns:



58
59
60
61
62
# File 'lib/vedeu/geometry/content_geometry.rb', line 58

def columns
  return width unless lines?

  lines.map { |line| line.size }.max
end

#rowsFixnum (private)

Returns the number of lines of content for this interface.

Returns:



49
50
51
52
53
# File 'lib/vedeu/geometry/content_geometry.rb', line 49

def rows
  return height unless lines?

  lines.size
end

#xnFixnum

Returns the width of the content, or when no content, the visible width of the interface.

Returns:



38
39
40
# File 'lib/vedeu/geometry/content_geometry.rb', line 38

def xn
  [columns, width].max
end

#ynFixnum

Returns the height of the content, or when no content, the visible height of the interface.

Returns:



30
31
32
# File 'lib/vedeu/geometry/content_geometry.rb', line 30

def yn
  [rows, height].max
end