Class: MapKit::DataTypes::MapRect
- Inherits:
-
Object
- Object
- MapKit::DataTypes::MapRect
- Defined in:
- lib/map-kit-wrapper/map_kit_data_types.rb
Overview
Wrapper for MKMapRect
Instance Attribute Summary collapse
-
#origin ⇒ Object
Returns the value of attribute origin.
-
#size ⇒ Object
Returns the value of attribute size.
Instance Method Summary collapse
-
#initialize(*args) ⇒ MapRect
constructor
MapRect.new(x, y, width, height) MapRect.new([x, y], [width, height]) MapRect.new(=> {:x => 5.0, :y => 8.0, :size => => 6.0, :height => 9.0}) MapRect.new(MapPoint, MapSize) MapRect.new(MKMapPoint, MKMapSize) MapRect.new(MapRect) MapRect.new(MKMapRect).
- #sdk ⇒ Object
- #to_h ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(*args) ⇒ MapRect
MapRect.new(x, y, width, height) MapRect.new([x, y], [width, height]) MapRect.new(=> {:x => 5.0, :y => 8.0, :size => => 6.0, :height => 9.0}) MapRect.new(MapPoint, MapSize) MapRect.new(MKMapPoint, MKMapSize) MapRect.new(MapRect) MapRect.new(MKMapRect)
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 222 def initialize(*args) self.origin, self.size = case args.size when 1 arg = args[0] case arg when Hash [arg[:origin], arg[:size]] else [arg.origin, arg.size] end when 2 [args[0], args[1]] when 4 [[args[0], args[1]], [args[2], args[3]]] end end |
Instance Attribute Details
#origin ⇒ Object
Returns the value of attribute origin.
213 214 215 |
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 213 def origin @origin end |
#size ⇒ Object
Returns the value of attribute size.
213 214 215 |
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 213 def size @size end |
Instance Method Details
#sdk ⇒ Object
240 241 242 |
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 240 def sdk MKMapRectMake(@origin.x, @origin.y, @size.width, @size.height) end |
#to_h ⇒ Object
252 253 254 |
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 252 def to_h {:origin => @origin.to_h, :size => @size.to_h} end |
#to_s ⇒ Object
256 257 258 |
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 256 def to_s to_h.to_s end |