Class: MapKit::DataTypes::MapSize

Inherits:
Object
  • Object
show all
Defined in:
lib/map-kit-wrapper/map_kit_data_types.rb

Overview

Wrapper for MKMapSize

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ MapSize

MapSize.new(10,12) MapSize.new([10,12]) MapSize.new(=> 10, :height => 12) MapSize.new(MKMapSize) MapSize.new(MapSize)



169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 169

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

#heightObject

Returns the value of attribute height.



162
163
164
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 162

def height
  @height
end

#widthObject

Returns the value of attribute width.



162
163
164
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 162

def width
  @width
end

Instance Method Details

#sdkObject



186
187
188
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 186

def sdk
  MKMapSizeMake(@width, @height)
end

#to_aObject



198
199
200
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 198

def to_a
  [@width, @height]
end

#to_hObject



202
203
204
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 202

def to_h
  {:width => @width, :height => @height}
end

#to_sObject



206
207
208
# File 'lib/map-kit-wrapper/map_kit_data_types.rb', line 206

def to_s
  to_h.to_s
end