Class: RestKat::ObjCProperty

Inherits:
Object
  • Object
show all
Defined in:
lib/rest_kat.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass, name) ⇒ ObjCProperty

Returns a new instance of ObjCProperty.

Raises:

  • (Exception)


85
86
87
88
89
90
# File 'lib/rest_kat.rb', line 85

def initialize(klass, name)
  raise Exception.new(":klass parameter cannot be nil") unless klass
  raise Exception.new(":name parameter cannot be nil") unless name
  self.klass = klass
  self.name = name
end

Instance Attribute Details

#klassObject

Returns the value of attribute klass.



83
84
85
# File 'lib/rest_kat.rb', line 83

def klass
  @klass
end

#nameObject

Returns the value of attribute name.



84
85
86
# File 'lib/rest_kat.rb', line 84

def name
  @name
end

Instance Method Details

#ns_attribute_typeObject



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/rest_kat.rb', line 92

def ns_attribute_type
    #         typedef enum {
    #             NSUndefinedAttributeType = 0,
    #             NSInteger16AttributeType = 100,
    #             NSInteger32AttributeType = 200,
    #             NSInteger64AttributeType = 300,
    #             NSDecimalAttributeType = 400,
    #             NSDoubleAttributeType = 500,
    #             NSFloatAttributeType = 600,
    #             NSStringAttributeType = 700,
    #             NSBooleanAttributeType = 800,
    #             NSDateAttributeType = 900,
    #             NSBinaryDataAttributeType = 1000,
    #             NSTransformableAttributeType = 1800,
    #             NSObjectIDAttributeType = 2000
    #             } NSAttributeType;
    case self.klass.objc_class
    when "NSNumber"
        case self.klass.json_type
        when "int"
            "NSInteger32AttributeType"
        when "float"
            "NSFloatAttributeType"
        when "bool"
            "NSBooleanAttributeType"
        end
    when "NSDate"
        "NSDateAttributeType"
    when "NSString"
        "NSStringAttributeType"
    else
        raise Exception.new("Unknown type #{self.klass.objc_class} for NSAttributeType to be handled for property #{self.name}" )
    end
    
end