Class: RestKat::ObjCClass
- Inherits:
-
Object
- Object
- RestKat::ObjCClass
- Defined in:
- lib/rest_kat.rb
Instance Attribute Summary collapse
-
#json_type ⇒ Object
Returns the value of attribute json_type.
-
#node ⇒ Object
Returns the value of attribute node.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#properties ⇒ Object
Returns the value of attribute properties.
-
#resource ⇒ Object
Returns the value of attribute resource.
-
#sequence_of ⇒ Object
Returns the value of attribute sequence_of.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #complex? ⇒ Boolean
- #enum ⇒ Object
- #enum? ⇒ Boolean
-
#initialize(type, json_type, node) ⇒ ObjCClass
constructor
A new instance of ObjCClass.
- #map? ⇒ Boolean
- #objc_class ⇒ Object
- #objc_properites_arg_list_decl ⇒ Object
- #objc_property_arg_decl(name) ⇒ Object
- #objc_property_decl(name) ⇒ Object
- #objc_super_class ⇒ Object
- #seq? ⇒ Boolean
Constructor Details
#initialize(type, json_type, node) ⇒ ObjCClass
Returns a new instance of ObjCClass.
136 137 138 139 140 141 |
# File 'lib/rest_kat.rb', line 136 def initialize type, json_type, node self.properties = nil self.type = type self.json_type = json_type self.node = node end |
Instance Attribute Details
#json_type ⇒ Object
Returns the value of attribute json_type.
86 87 88 |
# File 'lib/rest_kat.rb', line 86 def json_type @json_type end |
#node ⇒ Object
Returns the value of attribute node.
87 88 89 |
# File 'lib/rest_kat.rb', line 87 def node @node end |
#parent ⇒ Object
Returns the value of attribute parent.
85 86 87 |
# File 'lib/rest_kat.rb', line 85 def parent @parent end |
#properties ⇒ Object
Returns the value of attribute properties.
82 83 84 |
# File 'lib/rest_kat.rb', line 82 def properties @properties end |
#resource ⇒ Object
Returns the value of attribute resource.
88 89 90 |
# File 'lib/rest_kat.rb', line 88 def resource @resource end |
#sequence_of ⇒ Object
Returns the value of attribute sequence_of.
83 84 85 |
# File 'lib/rest_kat.rb', line 83 def sequence_of @sequence_of end |
#type ⇒ Object
Returns the value of attribute type.
84 85 86 |
# File 'lib/rest_kat.rb', line 84 def type @type end |
Instance Method Details
#complex? ⇒ Boolean
98 99 100 |
# File 'lib/rest_kat.rb', line 98 def complex? map? || seq? end |
#enum ⇒ Object
118 119 120 |
# File 'lib/rest_kat.rb', line 118 def enum node["enum"] end |
#enum? ⇒ Boolean
114 115 116 |
# File 'lib/rest_kat.rb', line 114 def enum? (node["type"] == "str") && node.has_key?("enum") end |
#map? ⇒ Boolean
102 103 104 |
# File 'lib/rest_kat.rb', line 102 def map? properties && (not properties.empty?) end |
#objc_class ⇒ Object
110 111 112 |
# File 'lib/rest_kat.rb', line 110 def objc_class self.type end |
#objc_properites_arg_list_decl ⇒ Object
130 131 132 133 134 |
# File 'lib/rest_kat.rb', line 130 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_property_arg_decl(name) ⇒ Object
126 127 128 |
# File 'lib/rest_kat.rb', line 126 def objc_property_arg_decl name "#{name}: (#{objc_class} *) #{name}" end |
#objc_property_decl(name) ⇒ Object
122 123 124 |
# File 'lib/rest_kat.rb', line 122 def objc_property_decl name "@property (nonatomic, strong) #{objc_class} * #{name}" end |
#objc_super_class ⇒ Object
90 91 92 93 94 95 96 |
# File 'lib/rest_kat.rb', line 90 def objc_super_class if resource "MSRestSerializableResource" else "MSRestSerializable" end end |
#seq? ⇒ Boolean
106 107 108 |
# File 'lib/rest_kat.rb', line 106 def seq? !!sequence_of end |