Class: Cocoa::CGRect

Inherits:
FFI::Struct
  • Object
show all
Defined in:
lib/cocoa/structs/NSRect.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ CGRect

Returns a new instance of CGRect.



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/cocoa/structs/NSRect.rb', line 3

def initialize *args
  options = args.first
  if options.is_a? Hash
    self[:origin][:x] = options[:x]
    self[:origin][:y] = options[:y]
    self[:size][:width] = options[:width]
    self[:size][:height] = options[:height]
  else
    super *args
  end
end