Class: Rect
- Inherits:
-
Object
- Object
- Rect
- Defined in:
- lib/amun/primitives/rect.rb
Overview
a primitive class that incapsulate a rectangle on screen, with position (top, left) and size (width, height)
Instance Attribute Summary collapse
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#left ⇒ Object
readonly
Returns the value of attribute left.
-
#top ⇒ Object
readonly
Returns the value of attribute top.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Rect
constructor
- create a rectangle with top, left, width and height opts(Hash)
-
a hash with keys (top, left, width, height).
Constructor Details
#initialize(opts = {}) ⇒ Rect
create a rectangle with top, left, width and height
- opts(Hash)
-
a hash with keys (top, left, width, height)
9 10 11 12 13 14 |
# File 'lib/amun/primitives/rect.rb', line 9 def initialize(opts = {}) @top = opts[:top] @left = opts[:left] @width = opts[:width] @height = opts[:height] end |
Instance Attribute Details
#height ⇒ Object (readonly)
Returns the value of attribute height.
5 6 7 |
# File 'lib/amun/primitives/rect.rb', line 5 def height @height end |
#left ⇒ Object (readonly)
Returns the value of attribute left.
5 6 7 |
# File 'lib/amun/primitives/rect.rb', line 5 def left @left end |
#top ⇒ Object (readonly)
Returns the value of attribute top.
5 6 7 |
# File 'lib/amun/primitives/rect.rb', line 5 def top @top end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
5 6 7 |
# File 'lib/amun/primitives/rect.rb', line 5 def width @width end |