Module: XDry::Boxing
- Defined in:
- lib/xdry/boxing.rb
Defined Under Namespace
Classes: ArrayConverter, Boxer, DateConverter, NSNumberConverter, NopConverter, StringConverter
Constant Summary
collapse
- SIMPLE_CONVERTIONS =
{
'int' => NSNumberConverter.new('intValue', 'numberWithInt'),
'NSInteger' => NSNumberConverter.new('integerValue', 'numberWithInteger'),
'NSUInteger' => NSNumberConverter.new('unsignedIntegerValue', 'numberWithUnsignedInteger'),
'BOOL' => NSNumberConverter.new('boolValue', 'numberWithBool'),
'float' => NSNumberConverter.new('floatValue', 'numberWithFloat'),
'CGFloat' => NSNumberConverter.new('floatValue', 'numberWithFloat'),
'double' => NSNumberConverter.new('doubleValue', 'numberWithDouble'),
'NSTimeInterval' => NSNumberConverter.new('doubleValue', 'numberWithDouble'),
}
- POINTER_CONVERTIONS =
{
'NSDate' => DateConverter.new,
'NSString' => StringConverter.new,
}
Class Method Summary
collapse
Class Method Details
.converter_for(type) ⇒ Object
196
197
198
199
200
201
202
203
204
205
206
207
208
209
|
# File 'lib/xdry/boxing.rb', line 196
def self.converter_for type
case type
when SimpleVarType
SIMPLE_CONVERTIONS[type.name]
when PointerVarType
case type.name
when 'NSArray', 'NSMutableArray'
return ArrayConverter.new(type.type_hint || 'NSObject', 'initWithDictionary', 'dictionaryRepresentation')
end
POINTER_CONVERTIONS[type.name]
else
nil
end
end
|
.retain_policy_of(type) ⇒ Object