Module: SugarCube::CGPointExtensions

Included in:
CGPoint, SugarCube::CoreGraphics::Point
Defined in:
lib/sugarcube/core_graphics.rb

Overview

Extensions to make CGPoint a “real class”

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



146
147
148
# File 'lib/sugarcube/core_graphics.rb', line 146

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#==(point) ⇒ Object



154
155
156
# File 'lib/sugarcube/core_graphics.rb', line 154

def ==(point)
  CGPointEqualToPoint(self, point)
end

#inspectObject



166
# File 'lib/sugarcube/core_graphics.rb', line 166

def inspect ; to_s ; end

#intersects?(rect) ⇒ Boolean

Returns:

  • (Boolean)


150
151
152
# File 'lib/sugarcube/core_graphics.rb', line 150

def intersects?(rect)
  CGRectContainsPoint(rect, self)
end

#to_hashObject



162
163
164
# File 'lib/sugarcube/core_graphics.rb', line 162

def to_hash
  CGPointCreateDictionaryRepresentation(self)
end

#to_sObject



158
159
160
# File 'lib/sugarcube/core_graphics.rb', line 158

def to_s
  "#{self.class.name}(#{self.x}, #{self.y})"
end