Class: GrADS::Command::Area
- Inherits:
-
Object
- Object
- GrADS::Command::Area
- Defined in:
- lib/grads/command.rb
Instance Attribute Summary collapse
-
#x1 ⇒ Object
readonly
Returns the value of attribute x1.
-
#x2 ⇒ Object
readonly
Returns the value of attribute x2.
-
#y1 ⇒ Object
readonly
Returns the value of attribute y1.
-
#y2 ⇒ Object
readonly
Returns the value of attribute y2.
Instance Method Summary collapse
- #center ⇒ Object
- #h ⇒ Object
-
#initialize(x1, x2, y1, y2) ⇒ Area
constructor
A new instance of Area.
- #mid ⇒ Object
- #w ⇒ Object
Constructor Details
#initialize(x1, x2, y1, y2) ⇒ Area
Returns a new instance of Area.
764 765 766 767 768 769 |
# File 'lib/grads/command.rb', line 764 def initialize (x1, x2, y1, y2) @x1 = x1 @x2 = x2 @y1 = y1 @y2 = y2 end |
Instance Attribute Details
#x1 ⇒ Object (readonly)
Returns the value of attribute x1.
771 772 773 |
# File 'lib/grads/command.rb', line 771 def x1 @x1 end |
#x2 ⇒ Object (readonly)
Returns the value of attribute x2.
771 772 773 |
# File 'lib/grads/command.rb', line 771 def x2 @x2 end |
#y1 ⇒ Object (readonly)
Returns the value of attribute y1.
771 772 773 |
# File 'lib/grads/command.rb', line 771 def y1 @y1 end |
#y2 ⇒ Object (readonly)
Returns the value of attribute y2.
771 772 773 |
# File 'lib/grads/command.rb', line 771 def y2 @y2 end |
Instance Method Details
#center ⇒ Object
781 782 783 |
# File 'lib/grads/command.rb', line 781 def center return @x1 + w/2 end |
#h ⇒ Object
777 778 779 |
# File 'lib/grads/command.rb', line 777 def h return @y2 - @y1 end |
#mid ⇒ Object
785 786 787 |
# File 'lib/grads/command.rb', line 785 def mid return @y1 + h/2 end |
#w ⇒ Object
773 774 775 |
# File 'lib/grads/command.rb', line 773 def w return @x2 - @x1 end |