Class: Vedeu::ContentGeometry
- Inherits:
-
Object
- Object
- Vedeu::ContentGeometry
- 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
-
#interface ⇒ Object
readonly
private
Returns the value of attribute interface.
Instance Method Summary collapse
-
#columns ⇒ Fixnum
private
Returns the character length of the longest line for this interface.
- #initialize(interface) ⇒ Vedeu::ContentGeometry constructor
-
#rows ⇒ Fixnum
private
Returns the number of lines of content for this interface.
-
#xn ⇒ Fixnum
Returns the width of the content, or when no content, the visible width of the interface.
-
#yn ⇒ Fixnum
Returns the height of the content, or when no content, the visible height of the interface.
Constructor Details
#initialize(interface) ⇒ Vedeu::ContentGeometry
22 23 24 |
# File 'lib/vedeu/geometry/content_geometry.rb', line 22 def initialize(interface) @interface = interface end |
Instance Attribute Details
#interface ⇒ Object (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
#columns ⇒ Fixnum (private)
Returns the character length of the longest line for this interface.
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 |
#rows ⇒ Fixnum (private)
Returns the number of lines of content for this interface.
49 50 51 52 53 |
# File 'lib/vedeu/geometry/content_geometry.rb', line 49 def rows return height unless lines? lines.size end |
#xn ⇒ Fixnum
Returns the width of the content, or when no content, the visible width of the interface.
38 39 40 |
# File 'lib/vedeu/geometry/content_geometry.rb', line 38 def xn [columns, width].max end |
#yn ⇒ Fixnum
Returns the height of the content, or when no content, the visible height of the interface.
30 31 32 |
# File 'lib/vedeu/geometry/content_geometry.rb', line 30 def yn [rows, height].max end |