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.



271
272
273
274
275
# File 'lib/rest_kat.rb', line 271

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.



204
205
206
# File 'lib/rest_kat.rb', line 204

def properties
  @properties
end

#resourceObject

Returns the value of attribute resource.



206
207
208
# File 'lib/rest_kat.rb', line 206

def resource
  @resource
end

#sequence_ofObject

Returns the value of attribute sequence_of.



205
206
207
# File 'lib/rest_kat.rb', line 205

def sequence_of
  @sequence_of
end

Instance Method Details

#cached=(val) ⇒ Object



212
213
214
215
216
217
218
219
# File 'lib/rest_kat.rb', line 212

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

#cached?Boolean

Returns:

  • (Boolean)


208
209
210
# File 'lib/rest_kat.rb', line 208

def cached?
  cached
end

#has_many_maps_propertiesObject



245
246
247
248
249
# File 'lib/rest_kat.rb', line 245

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

#has_many_primitives_propertiesObject



239
240
241
242
243
# File 'lib/rest_kat.rb', line 239

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

#has_many_propertiesObject



233
234
235
236
237
# File 'lib/rest_kat.rb', line 233

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

#has_one_propertiesObject



227
228
229
230
231
# File 'lib/rest_kat.rb', line 227

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

#objc_properites_arg_list_declObject



265
266
267
268
269
# File 'lib/rest_kat.rb', line 265

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



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

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

#objc_super_classObject



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

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

#primitive_propertiesObject



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

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