Class: RestKat::ObjCMapType

Inherits:
ObjCType show all
Defined in:
lib/rest_kat.rb

Instance Attribute Summary collapse

Attributes inherited from ObjCType

#cached, #json_type, #node, #objc_class

Instance Method Summary collapse

Methods inherited from ObjCType

#objc_property_arg_decl, #objc_property_decl

Constructor Details

#initialize(objc_class, json_type, node) ⇒ ObjCMapType

Returns a new instance of ObjCMapType.



279
280
281
282
283
# File 'lib/rest_kat.rb', line 279

def initialize objc_class, json_type, node
    super objc_class, json_type, node
    self.properties = nil
    self.cached = false
end

Instance Attribute Details

#propertiesObject

Returns the value of attribute properties.



212
213
214
# File 'lib/rest_kat.rb', line 212

def properties
  @properties
end

#resourceObject

Returns the value of attribute resource.



214
215
216
# File 'lib/rest_kat.rb', line 214

def resource
  @resource
end

#sequence_ofObject

Returns the value of attribute sequence_of.



213
214
215
# File 'lib/rest_kat.rb', line 213

def sequence_of
  @sequence_of
end

Instance Method Details

#cached=(val) ⇒ Object



220
221
222
223
224
225
226
227
# File 'lib/rest_kat.rb', line 220

def cached=val
  @cached = val
  if properties 
    properties.each do |property|
      property.klass.cached = val
    end
  end
end

#cached?Boolean

Returns:

  • (Boolean)


216
217
218
# File 'lib/rest_kat.rb', line 216

def cached?
  cached
end

#has_many_maps_propertiesObject



253
254
255
256
257
# File 'lib/rest_kat.rb', line 253

def has_many_maps_properties
    properties.select do |p|
        p.klass.is_a? ObjCSequenceOfMap
    end
end

#has_many_primitives_propertiesObject



247
248
249
250
251
# File 'lib/rest_kat.rb', line 247

def has_many_primitives_properties
    properties.select do |p|
        p.klass.is_a? ObjCSequenceOfPrimitve
    end
end

#has_many_propertiesObject



241
242
243
244
245
# File 'lib/rest_kat.rb', line 241

def has_many_properties
    properties.select do |p|
        p.klass.is_a? ObjCSequence
    end
end

#has_one_propertiesObject



235
236
237
238
239
# File 'lib/rest_kat.rb', line 235

def has_one_properties
    properties.select do |p|
        p.klass.is_a? ObjCMapType
    end
end

#objc_properites_arg_list_declObject



273
274
275
276
277
# File 'lib/rest_kat.rb', line 273

def objc_properites_arg_list_decl
  properties.reject{|p| p.name == 'id'}.map do |p|
    p.klass.objc_property_arg_decl p.name
  end.join "\n   "
end

#objc_protocolsObject



267
268
269
270
271
# File 'lib/rest_kat.rb', line 267

def objc_protocols
  ["NSCopying"].tap do |p|
    p << "MSRestResource" if resource
  end.join ', '
end

#objc_super_classObject



259
260
261
262
263
264
265
# File 'lib/rest_kat.rb', line 259

def objc_super_class
  if resource
    "MSRestSerializableResource"
  else
    "MSRestSerializable"
  end
end

#primitive_propertiesObject



229
230
231
232
233
# File 'lib/rest_kat.rb', line 229

def primitive_properties
    properties.select do |p|
        p.klass.is_a? ObjCPrimitiveType
    end
end