Class: Opine::Rect

Inherits:
Object
  • Object
show all
Defined in:
lib/opine/rect.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Rect

Returns a new instance of Rect.



4
5
6
7
8
# File 'lib/opine/rect.rb', line 4

def initialize options
  options.each do |key,value|
    send("#{key}=".to_sym,value)
  end
end

Instance Attribute Details

#heightObject

Returns the value of attribute height.



2
3
4
# File 'lib/opine/rect.rb', line 2

def height
  @height
end

#widthObject

Returns the value of attribute width.



2
3
4
# File 'lib/opine/rect.rb', line 2

def width
  @width
end

#xObject

Returns the value of attribute x.



2
3
4
# File 'lib/opine/rect.rb', line 2

def x
  @x
end

#yObject

Returns the value of attribute y.



2
3
4
# File 'lib/opine/rect.rb', line 2

def y
  @y
end

Instance Method Details

#==(other) ⇒ Object



14
15
16
# File 'lib/opine/rect.rb', line 14

def ==(other)
  x == other.x && y == other.y && width = other.width && height == other.height
end

#nativeObject



10
11
12
# File 'lib/opine/rect.rb', line 10

def native
  Cocoa::NSRect.new(x: x, y: y, width: width, height: height)
end