Module: SugarCube::CGSizeExtensions

Included in:
CGSize, SugarCube::CoreGraphics::Size
Defined in:
lib/sugarcube/core_graphics.rb

Overview

Extensions to make CGSize a “real class”

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



188
189
190
# File 'lib/sugarcube/core_graphics.rb', line 188

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

Instance Method Details

#==(size) ⇒ Object



197
198
199
# File 'lib/sugarcube/core_graphics.rb', line 197

def ==(size)
  CGSizeEqualToSize(self, size)
end

#infinite?Boolean

Returns:

  • (Boolean)


192
193
194
195
# File 'lib/sugarcube/core_graphics.rb', line 192

def infinite?
  infinity = CGRect.null[0][0]
  self.width == infinity or self.height == infinity
end

#inspectObject



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

def inspect ; to_s ; end

#to_hashObject



205
206
207
# File 'lib/sugarcube/core_graphics.rb', line 205

def to_hash
  CGSizeCreateDictionaryRepresentation(self)
end

#to_sObject



201
202
203
# File 'lib/sugarcube/core_graphics.rb', line 201

def to_s
  "#{self.class.name}(#{self.width} × #{self.height})"
end