Class: MapKit::DataTypes::MapPoint
- Inherits:
-
Object
- Object
- MapKit::DataTypes::MapPoint
- Defined in:
- lib/map-kit-wrapper/map_kit_data_types.rb
Overview
Wrapper for MKMapPoint
Instance Attribute Summary collapse
-
#x ⇒ Object
Attribute reader.
-
#y ⇒ Object
Attribute reader.
Instance Method Summary collapse
-
#api ⇒ Object
Returns the wrapped iOS MKMapPoint object.
-
#initialize(*args) ⇒ MapPoint
constructor
Initializer for MapPoint.
-
#to_a ⇒ Object
Get self as an Array.
-
#to_h ⇒ Object
Get self as a Hash.
-
#to_s ⇒ Object
Get self as a String.
Constructor Details
#initialize(*args) ⇒ MapPoint
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 223 def initialize(*args) args.flatten! self.x, self.y = case args.size when 1 arg = args[0] case arg when Hash [arg[:x], arg[:y]] else [arg.x, arg.y] end when 2 [args[0], args[1]] end end |
Instance Attribute Details
#x ⇒ Object
Attribute reader
211 212 213 |
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 211 def x @x end |
#y ⇒ Object
Attribute reader
211 212 213 |
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 211 def y @y end |
Instance Method Details
#api ⇒ Object
Returns the wrapped iOS MKMapPoint object
-
Returns :
-
A MKMapPoint representation of self
-
246 247 248 |
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 246 def api MKMapPointMake(@x, @y) end |
#to_a ⇒ Object
Get self as an Array
-
Returns :
-
[x, y]
-
276 277 278 |
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 276 def to_a [@x, @y] end |
#to_h ⇒ Object
Get self as a Hash
-
Returns :
-
{:x => x, :y => y}
-
286 287 288 |
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 286 def to_h {:x => @x, :y => @y} end |
#to_s ⇒ Object
Get self as a String
-
Returns :
-
"{:x => x, :y => y}"
-
296 297 298 |
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 296 def to_s to_h.to_s end |