Module: Cura::Attributes::HasCoordinates
- Includes:
- HasAttributes
- Included in:
- HasRelativeCoordinates, Cursor, Window
- Defined in:
- lib/cura/attributes/has_coordinates.rb
Overview
Adds the ‘x` and `y` attributes.
Instance Method Summary collapse
- #initialize(attributes = {}) ⇒ Object
-
#x ⇒ Integer
Get the X coordinate of this object.
-
#x=(value) ⇒ Integer
Set the X coordinate of this object.
-
#y ⇒ Integer
Get the Y coordinate of this object.
-
#y=(value) ⇒ Integer
Set the Y coordinate of this object.
Methods included from HasAttributes
Instance Method Details
#initialize(attributes = {}) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/cura/attributes/has_coordinates.rb', line 9 def initialize(attributes={}) @x = 0 unless instance_variable_defined?(:@x) @y = 0 unless instance_variable_defined?(:@y) super end |
#x ⇒ Integer
Get the X coordinate of this object.
|
# File 'lib/cura/attributes/has_coordinates.rb', line 16
|
#x=(value) ⇒ Integer
Set the X coordinate of this object.
27 |
# File 'lib/cura/attributes/has_coordinates.rb', line 27 attribute(:x) { |value| value.to_i } |
#y ⇒ Integer
Get the Y coordinate of this object.
|
# File 'lib/cura/attributes/has_coordinates.rb', line 29
|
#y=(value) ⇒ Integer
Set the Y coordinate of this object.
40 |
# File 'lib/cura/attributes/has_coordinates.rb', line 40 attribute(:y) { |value| value.to_i } |