Class: TypeCustomObject

Inherits:
ObjCType show all
Defined in:
lib/ObjCGenerator/types.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, type) ⇒ TypeCustomObject

Returns a new instance of TypeCustomObject.



179
180
181
182
# File 'lib/ObjCGenerator/types.rb', line 179

def initialize( name , type)
  super(name)
  @var_type = type
end

Instance Attribute Details

#var_typeObject

Returns the value of attribute var_type.



178
179
180
# File 'lib/ObjCGenerator/types.rb', line 178

def var_type
  @var_type
end

#varnameObject

Returns the value of attribute varname.



177
178
179
# File 'lib/ObjCGenerator/types.rb', line 177

def varname
  @varname
end

Instance Method Details

#conversion_value(origin) ⇒ Object



189
190
191
192
# File 'lib/ObjCGenerator/types.rb', line 189

def conversion_value origin
  # "[#{origin} description]"
  "[[#{var_type} alloc] initWithDict:#{origin}]"
end

#copyrow(newVarName) ⇒ Object



202
203
204
# File 'lib/ObjCGenerator/types.rb', line 202

def copyrow newVarName
  "#{newVarName}.#{self.varname}  = [self.#{self.varname} copyWithZone:nil];"
end

#default_valueObject



186
187
188
# File 'lib/ObjCGenerator/types.rb', line 186

def default_value
  "[#{@var_type} new]"
end

#description_rowObject



199
200
201
# File 'lib/ObjCGenerator/types.rb', line 199

def description_row
  "@\"self.#{self.varname} = %@\" , self.#{self.varname}"
end

#hash_rowObject



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

def hash_row
  "[self.#{self.varname} hash];"
end

#inEquality_test(other) ⇒ Object



196
197
198
# File 'lib/ObjCGenerator/types.rb', line 196

def inEquality_test other
  "![self.#{self.varname}  isEqual:#{other}.#{self.varname}]"
end

#property_definitionObject



183
184
185
# File 'lib/ObjCGenerator/types.rb', line 183

def property_definition
  "@property (nonatomic) #{@var_type} *#{@varname};"
end

#to_dictionary_itemObject



193
194
195
# File 'lib/ObjCGenerator/types.rb', line 193

def to_dictionary_item
  "@\"#{@varname}\" : [self.#{@varname} toDict]  ?: @{}"
end