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
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Instance Method Summary collapse
-
#initialize(*args) ⇒ MapPoint
constructor
MapPoint.new(50,45) MapPoint.new([50,45]) MapPoint.new(=> 50, :y => 45) MapPoint.new(MKMapPoint).
- #sdk ⇒ Object
- #to_a ⇒ Object
- #to_h ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(*args) ⇒ MapPoint
MapPoint.new(50,45) MapPoint.new([50,45]) MapPoint.new(=> 50, :y => 45) MapPoint.new(MKMapPoint)
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 118 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
Returns the value of attribute x.
112 113 114 |
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 112 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
112 113 114 |
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 112 def y @y end |
Instance Method Details
#sdk ⇒ Object
135 136 137 |
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 135 def sdk MKMapPointMake(@x, @y) end |
#to_a ⇒ Object
147 148 149 |
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 147 def to_a [@x, @y] end |
#to_h ⇒ Object
151 152 153 |
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 151 def to_h {:x => @x, :y => @y} end |
#to_s ⇒ Object
155 156 157 |
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 155 def to_s to_h.to_s end |