Class: MapKit::DataTypes::MapSize
- Inherits:
-
Object
- Object
- MapKit::DataTypes::MapSize
- Defined in:
- lib/map-kit-wrapper/map_kit_data_types.rb
Overview
Wrapper for MKMapSize
Instance Attribute Summary collapse
-
#height ⇒ Object
Attribute reader.
-
#width ⇒ Object
Attribute reader.
Instance Method Summary collapse
-
#api ⇒ Object
Returns the wrapped iOS MKMapSize object.
-
#initialize(*args) ⇒ MapSize
constructor
Initializer for MapSize.
-
#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) ⇒ MapSize
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 |
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 322 def initialize(*args) args.flatten! self.width, self.height = case args.size when 1 arg = args[0] case arg when Hash [arg[:width], arg[:height]] else [arg.width, arg.height] end when 2 [args[0], args[1]] end end |
Instance Attribute Details
#height ⇒ Object
Attribute reader
308 309 310 |
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 308 def height @height end |
#width ⇒ Object
Attribute reader
308 309 310 |
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 308 def width @width end |
Instance Method Details
#api ⇒ Object
Returns the wrapped iOS MKMapSize object
-
Returns :
-
A MKMapSize representation of self
-
345 346 347 |
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 345 def api MKMapSizeMake(@width, @height) end |
#to_a ⇒ Object
Get self as an Array
-
Returns :
-
[@width, @height]
-
375 376 377 |
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 375 def to_a [@width, @height] end |
#to_h ⇒ Object
Get self as a Hash
-
Returns :
-
{:width => width, :height => height}
-
385 386 387 |
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 385 def to_h {:width => @width, :height => @height} end |
#to_s ⇒ Object
Get self as a String
-
Returns :
-
"{:width => width, :height => height}"
-
395 396 397 |
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 395 def to_s to_h.to_s end |