Method: PerfectShape::Square#initialize
- Defined in:
- lib/perfect_shape/square.rb
#initialize(x: 0, y: 0, length: nil, size: nil, width: nil, height: nil) ⇒ Square
Constructs with x, y, length (optionally width or height can be passed as alias for length)
32 33 34 35 36 37 38 |
# File 'lib/perfect_shape/square.rb', line 32 def initialize(x: 0, y: 0, length: nil, size: nil, width: nil, height: nil) raise MESSAGE_WIDTH_AND_HEIGHT_AND_LENGTH_NOT_EQUAL if (length && size && length != size) length ||= size raise MESSAGE_WIDTH_AND_HEIGHT_AND_LENGTH_NOT_EQUAL if (length && width && length != width) || (length && height && length != height) || (width && height && width != height) length ||= width || height || 1 super(x: x, y: y, width: length, height: length) end |