Class: CGSize

Inherits:
Struct show all
Defined in:
lib/accessibility/bridge/mri.rb,
lib/accessibility/bridge/mri.rb,
lib/accessibility/bridge/common.rb

Overview

A structure that contains the size of a rectangle in a 2D co-ordinate system

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(width = 0.0, height = 0.0) ⇒ CGSize

Returns a new instance of CGSize.

Parameters:

  • width (Number) (defaults to: 0.0)
  • height (Number) (defaults to: 0.0)


40
41
42
# File 'lib/accessibility/bridge/mri.rb', line 40

def initialize width = 0.0, height = 0.0
  super width.to_f, height.to_f
end

Instance Attribute Details

#heightFloat

The heighth of the box

Returns:

  • (Float)


35
36
37
# File 'lib/accessibility/bridge/mri.rb', line 35

def height
  @height
end

#widthFloat

The width of the box

Returns:

  • (Float)


35
36
37
# File 'lib/accessibility/bridge/mri.rb', line 35

def width
  @width
end

Instance Method Details

#inspectString

Return a nice string representation of the size

Overrides Object#inspect to more closely mimic MacRuby Boxed#inspect.

Returns:



58
59
60
# File 'lib/accessibility/bridge/mri.rb', line 58

def inspect
  "#<CGSize width=#{self.width.to_f} height=#{self.height.to_f}>"
end

#to_sizeCGSize

Returns the receiver, since the receiver is already a CGSize

Returns:



16
17
18
# File 'lib/accessibility/bridge/common.rb', line 16

def to_size
  self
end